Hi, Until now with Rails when we would handle empty collections in apps, we had to code it like that :
<%# app/views/posts/index.erb %> <% if @posts.empty? %> <p>Sorry, there is no posts yet !</p> <% else %> <% render :partial => "post", :collection => @posts %> <% end % Now with my modest contribution we can handle it in one line in view : <%# app/views/posts/index.erb %> <%= render :partial => "post", :collection => @posts, :default_template => "no_post" %> <%# app/views/posts/_no_post.erb %> <p>Sorry, there is no posts yet !</p So we can implement Getting real notion called "The blank slate" more easily. One of you can review my patch (to see if i forget something) or comment it ? Thanks. --- lighthouse ticket : https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3187 patch : https://rails.lighthouseapp.com/projects/8994/tickets/3187/a/266544/empty_collections_rendering.diff --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" 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 this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
