Bryan_Ray
(Bryan Ray)
1
For starters ... the @op variable does not need to have the "@" symbol
inside the view. That makes it an "instance" ...
2nd ... you're not getting back an "Opinion" object where you do
"blog.opinions( ... )" you're getting back an "array of opinion"
objects.
You need to do something similar to this ...
<% opinions = blog.opinions( :user_id => current_user.id ) %>
<% for opinion in opinions %>
<center>
<%= h( opinion.rating ) %>
</center>
<% end %>
Hope that helps, man.
Good luck.
Charlie White wrote:
Thanks,
Could someone provide me with a simple explanation on when to use instance variables vs. when not to?
HI Charlie,
I had written this in response to a question here. It doesn't specifically address instance variables but gives the general feeling about what they do.
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/2ae42439587d32b9/4e71bbb39243f06e?l#4e71bbb39243f06e
Hopefully this will give you some idea. If it doesn't, I hope that someone can give you a better explanation
Cheers,
Mohit.
8/13/2007 | 9:18 AM.