I have a User model having comment id as primary key. Now I have another model note. I want to add note_id in user model. I have changed my associations
Previous associations:
# user.rb belongs_to :comment # comment.rb has_many :users, -> { order('users.display_date DESC') }, dependent: :destroy, inverse_of: :comment Current associations:
# user.rb belongs_to :note, optional: true # note.rb has_many :users, -> { order('users.display_date DESC') }, dependent: :destroy I have added records in user model and inserting note_id. But fetching records in console showing nil value.
User.last.note => nil Could someone help me where I am missing in associations?
comment_idcolumn tonote_id?