Maybe just put the logic in the controller?
if @brand.nil?
if @store.nil?
@brand_link_path = from_catalog_path(params[:id].blank? ?
Category.root.id : params[:id], product.id, product.name_url)
else
@brand_link_path = from_store_path(@store.id, product.id)
end
else
@brand_link_path = from_brand_path(@brand.id, product.id)
end
Then it simplifies your view:
<%= link_to(@brand_linnk_path) do -%> HTML HERE <% end %>
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/dzgOPAlRz7EJ.
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.