[Rails-core] Re: #3187 : Handle "blank slate" more easily with render method thanks to :default_template option

2009-09-14 Thread rouffj
Ok, thanks for all. Sorry if i was a bit persistent. It was my first contribution. I hope that i could help on other tickets on rails core. Subject closed. On Sep 14, 1:33 pm, Jeremy Kemper wrote: > Mateo suggests a plain Ruby shorthand since you don't like the > obvious, concise Ruby conditi

[Rails-core] Re: #3187 : Handle "blank slate" more easily with render method thanks to :default_template option

2009-09-14 Thread Jeremy Kemper
Mateo suggests a plain Ruby shorthand since you don't like the obvious, concise Ruby conditional. Not liking this shorthand is not cause for some even more obscure render option. The ticket was set to "wontfix" already. If you like the feature, please pursue it as a plugin. Best, jeremy On Mon,

[Rails-core] Re: #3187 : Handle "blank slate" more easily with render method thanks to :default_template option

2009-09-14 Thread rouffj
Mateo Murphy i think that your code proposal is a little bit less clear and more difficult to read. It's for that i created a patch. *For those who would like this to see this patch integrated to rails could you update the lighthouse ticket with +1.* lighthouse ticket : https://rails.lighthous

[Rails-core] Re: #3187 : Handle "blank slate" more easily with render method thanks to :default_template option

2009-09-13 Thread Mateo Murphy
You can already do this in one line: > <%= render :partial => "post", :collection => @posts or render :partial => "no_post" %> And soon you'll be able to do: <%= render @posts or render 'no_post' %> Which is about as concise as one could want! On 12-Sep-09, at 6:12 AM, Jeremy Kemper wrote:

[Rails-core] Re: #3187 : Handle "blank slate" more easily with render method thanks to :default_template option

2009-09-13 Thread Rodrigo Rosenfeld Rosas
I liked the idea. I was just wondering if ":when_blank =>" would not fit a bit better than ":if_blank". Not that it really changes nothing and I would still like the :if_blank option, but just an idea... Em 13-09-2009 12:40, Chris escreveu: > I like the idea of being able to render a collection

[Rails-core] Re: #3187 : Handle "blank slate" more easily with render method thanks to :default_template option

2009-09-13 Thread Chris
I like the idea of being able to render a collection in one line and I too find it a bit clunky to include the conditional and literal content for the blank condition alongside the 99% case. +1 for :if_blank -Chris On Sep 12, 6:15 am, rouffj wrote: > Thanks guys for your suggestions. I Think t

[Rails-core] Re: #3187 : Handle "blank slate" more easily with render method thanks to :default_template option

2009-09-12 Thread rouffj
Thanks guys for your suggestions. I Think that i'll adopt :if_blank option name. Thanks again. Anyone has other ideas ? On Sep 12, 4:33 am, Trek Glowacki wrote: > :if_nil doesn't describe all cases. The collection could be not nil > (e.g. an empty array) and you'd still want the blank slate to

[Rails-core] Re: #3187 : Handle "blank slate" more easily with render method thanks to :default_template option

2009-09-12 Thread Jeremy Kemper
On Fri, 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? %> >  Sorry, there is no posts yet ! > <% else %> >  <% render :partial => "po

[Rails-core] Re: #3187 : Handle "blank slate" more easily with render method thanks to :default_template option

2009-09-12 Thread Adam Hunter
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" > > ?? >

[Rails-core] Re: #3187 : Handle "blank slate" more easily with render method thanks to :default_template option

2009-09-11 Thread Trek Glowacki
:if_nil doesn't describe all cases. The collection could be not nil (e.g. an empty array) and you'd still want the blank slate to show. I'd suggest something related to blankness since it's the "blank slate" and both [ ].blank? and nil.blank? return true. render :partial => "post", :collection =

[Rails-core] Re: #3187 : Handle "blank slate" more easily with render method thanks to :default_template option

2009-09-11 Thread Jason King
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 :