associations

How does an associated database acquire its foreign key?

I did a bunch of gutting to my default controllers and now I can't get my user_id to populate on create. I was curious how that gets populated. If you're interested, take a look at my routes, and model assocations, and then at then end I'll show you the resulting params..The end result is no user_id being added. routes resources :user...

user , comment association not working, comment.user.email returns No method error?

I have the following models with associations as given below:- class Comment < ActiveRecord::Base belongs_to :post belongs_to :user end class Post < ActiveRecord::Base belongs_to :user has_many :comments end class User < ActiveRecord::Base devise :database_authenticatable, :registerable, :recoverable, :rememberable,...