views:

105

answers:

1

Hello, 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 :newitem %>
      <%= 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!

A: 

It's now form_for with :remote => true option

shingara
Thanks! I am new to ruby and based on your help I ended up learning about <% form_tag ( :remote=>true as an option as well when not mapping to ORM type object.
Kunal