Reputation: 3998
I'm trying to save a simple object with keys into two other existing objects. Here's the object:
class Tag < ActiveRecord::Base
belongs_to :User, :autosave => true
belongs_to :Comment, :autosave => true
end
I thought creating one of these would be as simple as
@uls = Tag.create(:Comment => @comment, :User => current_user )
@uls.save
This saves the tag correctly, but the user_id and comment_id fields are never set, they're always null. What is the correct command to get the foreign keys to save?
Upvotes: 0
Views: 154