I have a ‘user’ folder and an ‘appname’ folder. When a user signs up, i
want to call an action to send them to the ‘list’ page, which is in
‘appname’. However i can’t work out how to call an action in a
different controller/view in a different view folder (incidentally,
which is called - the controller action or the view page?).
I have a ‘user’ folder and an ‘appname’ folder. When a user signs up, i
want to call an action to send them to the ‘list’ page, which is in
‘appname’. However i can’t work out how to call an action in a
different controller/view in a different view folder (incidentally,
which is called - the controller action or the view page?).
Can anyone help please? This feels like it’s simple but i just don’t
know the syntax.
you might be looking at
redirect_to :controller => ‘appname’, :action => ‘list’
(if the ‘list’ action is in the appname; redirects there no matter what
controller you are in)
render :template => ‘appname/list’
(if you want to render the template, you can do this in the controller
or the view. the path is relative to the app/view directories)
I have a ‘user’ folder and an ‘appname’ folder. When a user signs up, i
want to call an action to send them to the ‘list’ page, which is in
‘appname’. However i can’t work out how to call an action in a
different controller/view in a different view folder (incidentally,
which is called - the controller action or the view page?).
Can anyone help please? This feels like it’s simple but i just don’t
know the syntax.
you might be looking at
redirect_to :controller => ‘appname’, :action => ‘list’
(if the ‘list’ action is in the appname; redirects there no matter what
controller you are in)
render :template => ‘appname/list’
(if you want to render the template, you can do this in the controller
or the view. the path is relative to the app/view directories)
hth
Never mind, i found the answer! I need to pass the controller as well -
redirect_to :controller => ‘appname’, :action => ‘list’
(if the ‘list’ action is in the appname; redirects there no matter what
controller you are in)
render :template => ‘appname/list’
(if you want to render the template, you can do this in the controller
or the view. the path is relative to the app/view directories)
hth
Ah, that second bit’s useful as well. Thanks a lot!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.