If I am in controller A and I want to show the index of controller B, how would I do that? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 > endNo, 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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
In controller A: render :controller_b, :action => "your_action" On Jul 11, 8:38 am, Joel Saltzmanjoelh <rails-mailing-l...@andreas- s.net> wrote:> 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. > -- > Posted viahttp://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
render :template => "foo/bar" On Jul 11, 12:35 pm, Joel Saltzmanjoelh <rails-mailing-l...@andreas- s.net> wrote:> 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. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---