Hello guys, A rails newbie here
I have 2 actions in my controller 1) index 2) refine_existing. Both of them show the results in the same format. How do I reuse the index.html.erb file?
When I try the following, it complains about refine_existing.erb not being present.
def refine_existing
...
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @results }
end
end
my index action looks like this
def index
#some logic to get @results
#set some session variables etc.
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @results }
end
end
Do I have to refactor my index view to contain partials that
a) make the headers
b) render @results
and reuse them?
Even though, both index.html.erb and refine_existing.html.erb will look exactly the same
Is there any way I can say in my refine_existing action to use index.erb view?
thanks in advance