Re: [Rails] Re: Re: Associations and Math between Models
On Wed, Sep 5, 2012 at 1:14 PM, Sa S. <lists@ruby-forum.com> wrote:
> Sorry, I should clarify. In my Model_2 view, I'm trying to simply have a
> table that iterates through all the model_1's and calculates that method
> above using the model_1's attribute that I need
But you're not showing us a view, you're showing us a model.
Do you really want `some_method` to return one value or an array
of values?
If you only want one value, why don't you pass the Model_1 instance
(or the attribute) you're interested in to the Model_2 instance?
def some_method(model_1_attribute)
attr_a * model_1_attribute
end
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home