I gotta be missing something. I have a controller action for short urls:
def shorturl
redirect_to :action => show, :id => Base58.decode(params[:id]) and return
end
My intention is have this either redirect or load the regular show method of the same controller. At this point, I don’t care which way, just want to get it working first.
The problem is it throws a missing template error like its not exiting the shorturl method.
Missing template controller/shorturl with {:locale=>[:en, :en], :formats=>[:html], :handlers=>[:rhtml, :rxml, :builder, :erb, :rjs]}
The console shows the query from show is executing so it seems its doing the redirect but still staying inside the method and expecting a view for shorturl instead of the redirected method.
open your terminal, and go to project directory and type
Will let you know about the various paths generated from your routes file.
then redirect using
Edit:–
redirect and render are too different things.
will send a 302 redirect request to your browser, the consequence being that any existing variables are lost [2], and the action called ‘my_action’ will be executed.
will NOT execute the code in the action called ‘my_action’ [1]. It will render the view only. Existing variables will not be lost.