Let s assume my controller gets a ajax call... I will start the
process to to the appropriate actions...
During the process I discover that the changes are too complex and I
cannot provide the user the response with just an ajax response...
instead I would need a full page fresh...
Unfortunelty, I ve got no idea how to solve this... :-(
Thanks a lot in advance...
-
Volker
-------
def my_action
if changes_are_too_complex
redirect_to :action => 'show' ...
else
# auto-render my_action.rjs template if its there
end
end
If you don't do anything, you'll get the template automatically. If
you do a redirect, the auto template will get skipped.
-- Wes
regards,
javier ramirez
--
--------
Estamos de estreno... si necesitas llevar el control de tus gastos visita http://www.gastosgem.com !!Es gratis!!
you can do that in the rjs or directly on the controller by using render
:update. Behind the scenes it will do domething pretty similar to what
you propose, which is changing window.location.href. The advantage is
you can use the parameters of redirect_to and you don't need to
implement anything at the server side
regards,
j
def my_action
if changes_are_too_complex
render :update do |page|
page.redirect_to :action => "show"
end
end
end
Also with the default my_action.rjs template (as indicated above).
-carl
On 3/6/07, wesgarrison <wes.ga...@gmail.com> wrote:
>
--
EPA Rating: 3000 Lines of Code / Gallon (of coffee)
I could'a sworn that I'd used redirect_to instead of
page.redirect_to.
Anyway, you can do your processing to determine what "too complex"
means, then either render a redirect, render some js in the
controller, or pass it to a .rjs template.
-- Wes
def my_action
#do stuff
if changes_are_too_complex
render :update do |page|
page.replace_html 'message_to_user_div', '<strong>Reloading
Page...</strong>'
page.call 'location.reload'
end
else
#do other stuff
end
end