[Rails] Re: link_to_remote > in :action , interrupt ajax to render a

oo00oo oo00oo at free.fr
Fri Jan 27 08:02:33 GMT 2006


Thanks :)
I hope that RJS will be part of the next release of rails. More easy 
than plugin.

> I don't think you can do it from insode the action like in the example 
> you gave, but you can do it with RJS (you need to be yusing edge rails.
>
> View:
>
> <%= link_to_remote 'yeah', :url => { :action => :theaction } %>
>
> Controller:
>
> def theaction
>   # update count here, you'll probably need to use the session
> end
>
> theaction.rjs:
>
> if @session[:count] > 0
>   page.redirect_to :action => :main
> else
>   page.replace_html 'div', :partial => "..."
> end
>
> Cheers, -Jonny.
>
>
>   



More information about the Rails mailing list