-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to render results collection #28
Comments
Shouldn't you be looping through @foos and printing each one? What output do On Thu, May 12, 2011 at 9:14 AM, bradseefeld <
|
See section 3.4.5 Rendering Collections @ http://guides.rubyonrails.org/layouts_and_rendering.html The above syntax lets me define a partial named _foo.html.erb. That template is rendered for each item in the @foos collection. It is equivalent to doing: <% @foos.each do |foo| -%> The long version works because there really isnt any rails magic going on (no need to know the model name). The desired version is more compact and typically the more accepted way when iterating through a collection of models. |
Got it, feel like fixing it? ;) Seems like it would be simple enough, add On Thu, May 12, 2011 at 1:08 PM, bradseefeld <
|
Oh, is that really it? Sorry, still fairly new to Ruby/Rails. I will give it a shot. Do i just fork, patch and send a pull request? |
yep, exactly. after you patch, you can install it locally on your machine to test it by On Thu, May 12, 2011 at 1:29 PM, bradseefeld <
|
In the controller
@foos = Foo.find(:all)
In the view
<%= render @foos %>
Generates:
undefined method `model_name' for SimpleRecord::ResultsArray:Class
The text was updated successfully, but these errors were encountered: