Ruby on Rails Saturday, January 20, 2018

On Sat, Jan 20, 2018 at 10:16 AM, kenatsun <kenatsun@gmail.com> wrote:

> I added class_name: "Worker", foreign_key: "worker_id" to both Person and
> Offer, so the class definitions look like:
> class Person < ApplicationRecord
> has_many :offers, class_name: "Worker", foreign_key: "worker_id"
> end
>
> class Offer < ApplicationRecord
> belongs_to :person, class_name: "Worker", foreign_key: "worker_id"
> end
> but the forms still misbehave as described earlier.

Uh, well -- this will probably help:

http://guides.rubyonrails.org/association_basics.html#bi-directional-associations

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
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-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yBLAHLSqXTW33WauXmPfwu%2BedJOkm%2Bba9gmdBt2EzREnw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment