Hey - I have a few ajax calls in my app that I'm not really sure how to
degrade to html. For the most part, these are functions that insert or
remove elements to/from the dom.

For example, I have my own edit-in-place on the data, which is called by
start_edit action. This action renders an rjs template that replaces the
view with an edit form.

# view (partial)

<tr id="prod_<%=h product.id %>
    onclick="<%= remote_function(:url => { :action => 'start_edit',
                                 :id => @product} )%>" >
  <td><%=h product.name %></td>
</tr>

# controller

def start_edit
  prod = params[:id]
  params[:row] = "prod_#{prod.id}"
  respond_to do |format|
    format.js { render :template => 'rjs/start_edit' }
  end
end

# rjs

page.replace_html params[:row], :partial => 'edit', :object =>
params[:id]

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

Reply via email to