« Return to Thread: deleting model objects

Re: deleting model objects

by Alex Wayne :: Rate this Message:

Reply to Author | View in Thread


remove_req.rjs
page.replace_html :main-body, :partial => 'requirement_list'

view:
<%= link_to_remote 'Remove', :url => { :action => 'remove_req' }, :with
=> "'id=#{post.requirement_id}'" %>

control:
  def remove_req
    Post.delete_all "requirement_id = #{params[:id]}"
    respond_to do |format|
          format.html { redirect_to :action => :index }
          format.js { flash[:notice] = "ok" }
      end
  end

It doesn't replace the html =(

Suggestions?

Thanks!
--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

 « Return to Thread: deleting model objects

LightInTheBox - Buy quality products at wholesale price!