Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add associations to models/impression.rb #266

Open
sithara opened this issue Mar 8, 2018 · 1 comment
Open

Add associations to models/impression.rb #266

sithara opened this issue Mar 8, 2018 · 1 comment

Comments

@sithara
Copy link

sithara commented Mar 8, 2018

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

@codeundercoverdev
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants