Saturday, July 9, 2011

Re: [Rails] looping through results of complex query

solved the problem and feel a bit stupid but, at the same time not.

I accessed ration.ration_name by simply doing this in my loop:

[code]
herd_ration.ration_name
[/code]

The part I'm not understanding, is that when I used inspect in the loop, it
did not display any reference to to ration.ration_name:

[code]
@herd_rations_during_season.each do |herd_ration|
puts("----herd_ration: #{herd_ration.inspect}") #doesn't display
ration_name anywhere
end
[/code]

Chirag Singhal wrote:
>
> Probably because in your select clause, you aren't selecting
> herd_rations.ration
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/xlhlA_zkL10J.
> 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 this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
>

--
View this message in context: http://old.nabble.com/looping-through-results-of-complex-query-tp31951568p32028220.html
Sent from the RubyOnRails Users mailing list archive at Nabble.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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate