--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/bfbf73d2-2cf4-4c52-9896-5b58028f6f3d%40googlegroups.com.
Use „class_name“, not „class“ as option key. Also, from the Model that *holds the ID* of the other Model, it’s always „belongs_to“.
So in Event:belongs_to :approver, class_name: „User“and you’re good to go.
I KNOW this is probably very simple, but I am scratching my head trying to get it to work...--I have a table with a key named approver_idWhat I want to do is associate this to the User classSo I can do Event.approver.first_name, etc...in Event I havehas_one :approver, class: 'User'So how do I define the relationship to associate Event.approver_id to User.idJohn
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonra...@googlegroups.com.
Am 26.01.2020 um 23:12 schrieb John Sanderbeck <band...@gmail.com>:
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/19718c01-2b17-434b-90d4-866626ad7911%40googlegroups.com.