in one of my views, i have some links, and depending on the value i set
in a variable, that chooses what partial i display.
for example in my view
link to “get all”, :action view, :id => something1, :switchOn =>
‘maincategory’
link to “get all”, :action view, :id => something2, :switchOn =>
‘subcategory’
controller
def view
if params[:switchOn] == ‘maincategory’
Bbq.find(:all) @switchOn = ‘main’
end
if params[:switchOn] == ‘subcategory’
Bbq.find(:all, :condtion … something) @switchOn = ‘sub’
end
end
view.rhtml
if @switchOn == ‘main’
render partial ‘viewmain’
end
if @switchOn == ‘sub’
render partial ‘viewsub’
end
doing this way, my url is kind of ugly. do i just rewrite or customize
my routes.rb?