Question

I have a Rails app where on the home page home/index.html.erb, I show a partial for the model workorders. It currently defaults to the home_controleer.rb with the action index.

Can I select the workorders_controller.rb and action index2?

I tried this in the home/index.html.erb view file:

<%= render :partial => "workorders/index7", :controller => "workorders", :action => "index2" %>

But it's not working.

Was it helpful?

Solution

Try this instead:

<%= render :template => "workorders/index2" %>

source: https://stackoverflow.com/a/6051812/2128691

edit: in response to your last comment...

I haven't really worked with bootstrap, but maybe you could do something like this [pseudocode]:

def home
  if [x condition] 
    redirect_to index_seven_path
  else
    render :action => [y action]
  end
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top