Are you including rails.js?

On Dec 16, 12:16 am, loominator1970 <[email protected]> wrote:
> This seems like it should be pretty straightforward, but its stumping
> me.  I have a small form that I am trying to submit using jquery that
> is supposed to remove an association between to HABTM models.  For the
> sake of argument, the models are Course and Student.
>
> # view
>      <%= form_tag ( remove_student_from_course_path, :remote => true )
> %>
>         <%= hidden_field_tag "course_id", @course.id %>
>         <%= hidden_field_tag "student_id", @student.id %>
>      <%= submit_tag 'Remove' %>
>
> # controller
>   def remove_student_from_class
>     @student = Student.find(params[:student_id])
>     @msg = Factor.method_to_remove_student_from_class(params)
>
>     respond_to do |format|
>         format.html { redirect_to edit_class_path(@class) }
>         format.js
>     end
>   end
>
> # remove_student_from_class.js.erb
> // reload the page
> location.reload();
>
> Everything works fine, except the HTML code is generated and not the
> JS code in the respond_to block.  I would expect the JS call to get
> fired since I have the ':remote => true' line in there, but its always
> the HTML and it generates the page.  What am I overlooking?
>
> Dave

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to