Glen's solution works perfect !
Thank you very much, your tip is a must have of every rails project,
IMHO :)
--
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
Here is a cleaner way. Just put the following code on your
application_controller.rb.
Now, redirect_to should work with Ajax calls as well as regular
requests.
def redirect_to(options = {}, response_status = {})
if request.xhr?
render(:update) {|page| page.redirect_to(options)}
else
s
Vicer Ontero wrote:
>> And make sure you're *not* using the :update option on your remote_form.
>> 'page.redirect_to()' will generate javascript similar to Hassan's
>> aforementioned suggestion.
>
> Hi, just a note that this does not work. Because the redirect gets
> trapped inside the Ajax cal
Sjoerd Andringa wrote:
> Hi daociyiyou ,
>
> Try this:
>
> def find_created_actions
> unless @if_login
>flash[:login]="..."
>redirect_to(:controller=>"login",:action=>"login")
> end
> if @if_login
>@user_cactio...@user.sponsored_actions
>render :update
Hi daociyiyou ,
Try this:
def find_created_actions
unless @if_login
flash[:login]="..."
redirect_to(:controller=>"login",:action=>"login")
end
if @if_login
@[EMAIL PROTECTED]
render :update do |page|
page.replace_html 'element_id',
:p
On Thu, Oct 16, 2008 at 1:24 AM, daociyiyou <[EMAIL PROTECTED]> wrote:
>
> I have an ajax call method like following:
> ##
> def find_created_actions
>unless @if_login
> flash[:login]="请登录或注册"
> redirect_to(:controller=>"login",:action=>"login")
>end
>
6 matches
Mail list logo