what about using
<% unless child_index.blank? -%>
Do something
<% else -%>
Do something else
<% end -%>
Thank you
Rodrigo Dominguez
David Sousa wrote:
> Hello,
>
> I want to be able to call a partial with and without a local.
> E.g.:
> 1 - <%= render :partial => "/contacts/phones/create", :locals => {
> :parent_form => contact_form, :phone => Phone.new} %>
>
> 2 - <%= render :partial => "/contacts/phones/create", :locals => {
> :parent_form => contact_form, :phone => Phone.new, :child_index => "111"
> } %>
>
> In my partial I have:
>
> <% if child_index -%>
> Do something
> <% else -%>
> Do something else
> <% end -%>
>
> The problem is that, when I don't pass the local child_index, the
> partial don't render and give me a error. What is the problem?
>
> Thanks,
> David Sousa
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---