I have a Show model that has_one :venue, which is accomplished with each show having a venue_id
And my Venue model belongs_to :show
However I am having a problem accessing the venue by doing show.venue
Consider the following code where s is a Show instance
logger.info("*********************")
logger.info("#{s.inspect}")
logger.info("#{Venue.find(s.venue_id)}") # Works
logger.info("#{s.venue}") # Causes a MySQL Error
logger.info("*********************")
I feel like the line that causes the MySQL error should work. This is the error:
ActiveRecord::StatementInvalid (Mysql::Error: Unknown column 'venues.show_id' in 'where clause': SELECT * FROM `venues` WHERE (`venues`.show_id = 95) LIMIT 1)
I have no idea why it is trying to access venues.show_id.
Any ideas?
Thanks!