1

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!

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

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.
0

Remember to use :disable_with option to make it more clear to the user:

<%= submit_tag "Add item with Ajax", :disable_with => "Adding..." %>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.