def redirect_or_render( redirect_to_hash, render_page ) if @request.xhr? render(render_page) else redirect_to(redirect_to_hash) end end
Use like this:
redirect_or_render( {:action=>'foo'}, { :partial => 'monkey', :locals => { :obj = > 'x' } } )
12374 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
def redirect_or_render( redirect_to_hash, render_page ) if @request.xhr? render(render_page) else redirect_to(redirect_to_hash) end end
redirect_or_render( {:action=>'foo'}, { :partial => 'monkey', :locals => { :obj = > 'x' } } )
You need to create an account or log in to post comments to this site.
I am new javascipt lanuae can any body send javascript goodies