Thanks botp and Frederick ~

On Saturday, January 20, 2018 at 1:29:32 AM UTC-5, bot Peña wrote:
>
>
> ​belongs_to (and other assocns) has options for class name and foreign 
> key.​ see ri or doc.
> otoh, i wonder if it would have been easier to create just another Worker 
> resource (and probly delete Person); but ymmv prolly.
>
> best regards --botp
>

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.

 

-- 
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+unsubscr...@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/40b8235b-aec6-4a67-a478-c3aac51855c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to