Rails 4.1, Ruby 2.1.
I'm trying to build a new model through an association, and I need an ID reference to an object that has not been created yet.
I have something like this:
@user = User.new(user_params) @user.adminships.build(adminable_type: 'Program', adminable_id: current_user.programs.first.id) @user.save This is weird to me since I expected the association to be set up automatically, but for some reason I get a ["User can't be blank"] error.
When I run the code in the Rails console, it seems to work fine.
Any ideas?