rails 4, active record: appending to has_many :through does not create join model anymore?

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


class Post < AR::Base

has_many :readers

has_many :people, through: :readers


@post.people << Person.new

so, basically this is not working: Active Record Associations — Ruby on Rails Guides


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

yech. found the culprit. my fault.

lesson learned: don’t fuck around by aliasing association accessors.

sorry to bother you.

anthony, just tried and it works with unsaved instances as well :slight_smile: thanks.