I rendering a view partially like this.
<%= render(:partial => "index" ,:controller=>"controller_name") %>
so this will partially render controller_name/_index.html.erb
here is my doubt. can i write an action method for this _index. something like this?
class ControllerNameController < ApplicationController
def _index
end
end
thanks.
No this should be
EDITED: Explaining my answer in detail –
When you write a method
method_nameand you do notrender(redirect_to) anything, the controller will look for pagemethod_name.html.erbby default.However, using
render :partialas shown below, the action will work with the partial instead.For Example