impressionist
impressionist copied to clipboard
Add associations to models/impression.rb
Hi
Can we add impression.rb
to app/models
that takes in user_id from a table other than users
table? I tried adding belongs_to
association but it does not work.
class SomeUser < ActiveRecord::Base validate :user_name end
Is there some way I can access this as Impression.first.user_name => which gives me the current user name for that particular impression
Kind Regards Sithara
I am also trying to do this. I tried to make a model like normal but it gets ignored by rails.
class Impression < ApplicationRecord
belongs_to :sticker, optional: true
end