I have two models that are associated with has_and_belongs_to_many, and
I'm trying to create a method that computes something with attributes
from both models, but I'm getting an undefined method error with the
code I'm using below. What am I missing?

Model_1.rb

Class Model_1 < ActiveRecord::Base
...
has_and_belongs_to_many :model_2

def some_method
    attr_1 * Model_2.find(model_2_id).attr_I_need
end

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to