all, I am a little stuck on a exercise I am trying while learning RoR. I have a form I want to submit to my controller and have the results populate a div tag further down. I have rails 3.0 and ruby 1.8.7. When I try the following: Ajax List Demo
Listing posts
<%= javascript_include_tag 'prototype' %>
</head>
<body>
<h3>Add to list using Ajax</h3>
<%= form_remote_tag(:update => "list_profiles", :url => { :action => :list }) %>
New item text:
<%= text_field_tag :newi开发者_运维百科tem %>
<%= submit_tag "Add item with Ajax" %>
<%= end_form_tag %>
<ul id="my_list">
<li>Original item... please add more!</li>
</ul>
</body>
</html>
I get this as the error:
undefined method `form_remote_tag' for #<#<Class:0x8448e88>:0x8447d48>
Can anyone tell me why I am getting this, and if there is a tutorial I should be reading about using ajax in rails forms? Thanks!
It's now form_for with :remote => true
option
Remember to use :disable_with
option to make it more clear to the user:
<%= submit_tag "Add item with Ajax", :disable_with => "Adding..." %>
精彩评论