2

I am switching from 2.3.x to 3.0.7 and I am stuck doing the simplest of things.

I am just trying to create a link to remote, but it doesn't seem to work correctly.

From index.html.erb

<%= link_to "test", test_path, :remote => true, :update => "test_div" %>
<div id="test_div"></div>

From home_controller.rb

def index  
end

def test
    render :text => 'test'
end

From routes.rb

match '/' => 'home#index'
match '/test', :to => 'home#test'  

Should be simple stuff. I click the link the "test" and in server console:

Rendered home/index.html.erb within layouts/application (15.6ms)
Completed 200 OK in 31ms (Views: 31.2ms | ActiveRecord: 0.0ms)

Started GET "/test" for 127.0.0.1 at Fri May 06 20:15:03 -0400 2011
  Processing by HomeController#test as JS
Rendered text template (0.0ms)
Completed 200 OK in 16ms (Views: 15.6ms | ActiveRecord: 0.0ms)

In firebug it says:

GET http://localhost:3001/test 304 Not Modified 40ms    

Response

test

Nothing shows up in my test_div. I don't understand, what am I doing wrong?

user647345
  • 143
  • 9

1 Answers1

1

:update has been removed from Rails 3. You can see Rails 2 to Rails 3 : using link_to instead of link_to_remote (including remote and update) for some details and some pointers on other ways of getting what you need.

Community
  • 1
  • 1
muffinista
  • 6,676
  • 2
  • 30
  • 23