firstruby

Master ruby with us

link_to_remote in Rails 3.x, AJAX link with link_to and :remote => true in rails 3.x

Posted by firstruby on August 8, 2010

In Rails < 3.x,

AJAX link_to_remote code is,

<%= link_to_remote "Click me", :url => update_user_url(user), :method => :put %>

In Rails >= 3.x, AJAX link_to is,

<%= link_to "Click me", user_url(user), :remote => true, :method => :put %>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: