views:

53

answers:

1

I think the code is more explicit

option A

class RedirectController < ApplicationController
  def index
    redirect_to :controller => 'posts', :action => 'show', :id => 1
    # it works
  end
end

option B

class RedirectController < ApplicationController
  def index
    render :controller => 'posts', :action => 'show', :id => 1
    # it doesn't work
  end
end

Is possible in (B) to load another action in another controller? (and not just the view) How? Thanks

+2  A: 

Hi try render 'posts/show' or render :template => 'posts/show'

Bohdan Pohorilets
Thanks it works in both ways but it isn't very clean because I had to add @post .. @post = Post.find 1 render 'posts/show'
render_component should do the trick but it is obsolete