content01
content01

Reputation: 3225

How to render to another controller's action in Ruby on Rails 2.3.9

I'm trying to render from a pnr controller to the index of a web_services and I need to specify a layout as well.

I tried:

render :layout => "admin", :action => "web_services/index"
render :layout => "admin", :"web_services/index"
render :layout => "admin", :controller => "web_services", :action => "index"

and nothing works.

What should I use?

RESOLVED

DONE! I had to use:

redirect_to :layout => "admin", :controller => 'web_services', :action => 'index'

Upvotes: 1

Views: 2330

Answers (1)

RocketR
RocketR

Reputation: 3766

The :layout option for redirect_to is meaningless as redirect only needs a path and a status, and layout is just a name of the template. Also, as the name implies, redirect_to doesn't render anything, it tells the browser to go to another page. I suggest you to read the RoR guides at guides.rubyonrails.org.

Upvotes: 1

Related Questions