ruby on rails - unable to access model related with has_one -


My two models are: show and location . The show has a place, while each spot is in the show. This condition is defined in both model files with is_on and; Correctly the related_to statement However, I can not use this site by using show.venue . Consider the following code where s is a show example:

  logger.info ("************************************************* **************************************************************************************************** * **** ") logger.info (" # {s.inspect} ") logger.info (" # {Venue.find (s.venue_id}} "# # Works logger.info (" # ss.venue} ") # A MySQL error logger.info (" ************* ")  

I think whatever line causes mysql error That's what he does. This error is:

  ActiveRecord :: StatementInvalid (Mysql :: Error: Unknown column 'venues.show_id' in 'where clause': SELECT * FROM `venues` WHERE (` Site 'Show_id = 95) 1)  

I do not know why it is trying to reach venues.show_id . Any ideas?

You have returned the foreign key in ActiveRecord's conferences, with related class to the foreign table Along with the database table should be mapped. See: "Associated Association is always used in the model that has a foreign key." It makes some sense, if you think that is related to the way that interacts with I_one and has_many (as you obviously can not put foreign keys in has_many models)

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -