Rails: confused about syntax for passing locals to partials

Understanding Rails "magic" with regards to rendering partials (and passing locals into them).

Why does this work:

<%= render "rabbits/form" %>

And this work:

<%= render "rabbits/form", :parent => @warren, :flash => flash %>

but this does not work:

<%= render "rabbits/form", :locals => { :parent => @warren, :flash => flash } %>

But this does:

<%= render :partial =>"rabbits/form", :locals => { :parent => @warren, :flash => flash } %>

Also, how can I look up these nuances so I don't need to bother people on S.O.?

98
задан Meltemi 9 December 2010 в 20:00
поделиться