I've set up a has_and_belongs_to_many association between two models. I need to access an attribute from one of the models for a method in another model. Right now my code looks like this, but I'm getting an error saying 'undefined local variable 'model1_id''
Model_2.rb
Class Model_2 < ActiveRecord:: Base
...
has_and_belongs_to_many :model_1
def some_method
attr_1 * Model_1.find(model_1_id).attr_I_need
end
What am I missing? Thanks!