If I am in controller A and I want to show the index of controller B,
how would I do that?
Wouldn’t you just do a simple redirect?
def create
@scenario = Scenario.new(params[:scenario])
if @scenario.save
flash[:notice] = ‘Scenario was successfully created.’
# where do we return to?
case params[:from_type]
when ‘project’
redirect_to projectview_path(params[:from_id])
else
redirect_to scenarioviews_path
end
else
render :action => “new”
end
end
Ar Chron wrote:
Wouldn’t you just do a simple redirect?
def create
@scenario = Scenario.new(params[:scenario])
if @scenario.save
flash[:notice] = ‘Scenario was successfully created.’
# where do we return to?
case params[:from_type]
when ‘project’
redirect_to projectview_path(params[:from_id])
else
redirect_to scenarioviews_path
end
else
render :action => “new”
end
end
No, I dont want to redirect to another controller. I want to stay in my
current controller.
Here is what I did:
from my controller A I ran an RJS file.
The RJS file replaces my content area with a partial.
My partial uses one line of code
<%= render_file “CONTROLLER_B_NAME/index.html.erb” %>
If anybody else knows a better why, I’d be appreciative to hear it.
In controller A:
render :controller_b, :action => “your_action”
On Jul 11, 8:38 am, Joel Saltzmanjoelh <rails-mailing-l…@andreas-
s.net> wrote:
redirect_to projectview_path(params[:from_id])
Po
sted viahttp://www.ruby-forum.com/.
Phil wrote:
In controller A:
render :controller_b, :action => “your_action”
On Jul 11, 8:38 am, Joel Saltzmanjoelh <rails-mailing-l…@andreas-
s.net> wrote:redirect_to projectview_path(params[:from_id])
Po
sted viahttp://www.ruby-forum.com/.
That doesnt work at all…
On Jul 10, 10:15 pm, Joel Saltzmanjoelh <rails-mailing-l…@andreas-
s.net> wrote:
Phil wrote:
In controller A:
render :controller_b, :action => “your_action”
I believe it’s:
render(:controller => “controller_name”, :action => “your_action”)
I haven’t tried it, but that’s the syntax for redirect_to
HTH.
greenideas wrote:
On Jul 10, 10:15�pm, Joel Saltzmanjoelh <rails-mailing-l…@andreas-
s.net> wrote:Phil wrote:
In controller A:
render :controller_b, :action => “your_action”
I believe it’s:
render(:controller => “controller_name”, :action => “your_action”)
I haven’t tried it, but that’s the syntax for redirect_to
HTH.
Thanks, that doesnt work for rendering though. oh well.