The concept is great! Maybe go :if_blank since that's the check you are running on it.
Adam On Sep 11, 2009, at 8:05 PM, Jason King wrote: > > I like the concept, not the name. Can I suggest something like: > > render :partial => "post", :collection => @posts, :if_nil => "no_post" > > ?? > > On Sep 11, 2009, at 2:20 PM, rouffj wrote: > >> >> 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 -~----------~----~----~----~------~----~------~--~---
