On Tue, Sep 4, 2012 at 9:53 AM, sacshu <[email protected]> wrote:

> When I use the code below, I get an error saying
> 'undefined method model_1_id'. What am I missing? Thanks!

> Class Model_2 < ActiveRecord::Base
> ...
> has_and_belongs_to_many :model_1
>
> def some_method
>    attr_a * Model_1.find(model_1_id).attr_I_need
> end

Where do you think 'model_1_id' is being defined here?

-- 
Hassan Schroeder ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan

-- 
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