<% unless params[:context] == :gallery -%> question


I have a template that is called by two different methods. I only want
part of it too show up when it is called from one of the methods. It
always shows up for me. Can someone help to point out my error? Below
is the method that should keep part of the tempate from printing, and
the relevent part of the template.

def gallery
@product_pages,@products = paginate(:products, :per_page => 12,
:conditions => “sold != ‘current’”)
render( :template => “store/index”,
:params => { :context => :gallery})

<% unless params[:context] == :gallery -%>
<%= @products[0].price %>

<%= link_to ‘Add to Cart’,
{:action => ‘add_to_cart’, :id => product },
:class => ‘addtocart’ %>

<% end -%>



in the controller, try:
@context = :gallery
render :template => “store/index”

and in the template
<% unless @context == :gallery -%>

There’s a :locals option for render, but it seems that it works only for
rendering partials.