You probably need to use "create" and not "new" so there is something to
put in the foreign keys.


On Wed, May 22, 2013 at 11:09 AM, glaszig <[email protected]> wrote:

> hi folks.
>
> on rails 4, can somebody confirm that pushing model instances onto a
> has_many :through relation does not create the necessary join model anymore?
>
>     class Reader < AR::Base
>       belongs_to :post
>       belongs_to :person
>     end
>
>     class Post < AR::Base
>       has_many :readers
>       has_many :people, through: :readers
>     end
>
>     @post.people << Person.new
>
> so, basically this is not working:
> http://guides.rubyonrails.org/association_basics.html#has_many-uniq
>
> thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to