I’m a noob trying to do this:
<% if @page[:title] == "Portraits" %>
<%= render :partial => "/shared/slideshow" %>
<% elsif @page[:title] == "Escapes" %>
<%= render :partial => "/shared/slideshow" %>
<% elsif @page[:title] == "Articulos pa Web" %>
<%= render :partial => "/shared/slideshow" %>
<% end %>
There has to be a concise way to do this, but I just can’t figure it out.
Avoid putting the logic you currently have, in a view.
Put this in a helper method instead and use it in the view:
And in your view:
Or, if you do not want to render a partial if a name is not in the array:
Note that the
?is part of the method name. Isn’t Ruby wonderful? 😀