Im trying to implement an inline editor for table data. The problem ok is pressed and no route can be found. Im attempted to send the result to the update controller method so put tracks/3 eg named route track_path(id) with method => put an example row from a track partial below: <td> <span id="<%= "#{dom_id(track)}_title" %>"><%= track.title %></span> <%= in_place_editor "#{dom_id(track)}_title", {:url => url_for(track_path(track)), :method=>"PUT"} %> </td> On selecting OK i get: no route match found with gt: tracks/3 gt etc :method=>''put'' note when i alter the named route to read: tracks_path(track) it gets to the create method. Meaning that i just need to set the method to put. Man this put/update issue has plauged me on many fronts today. i was considering using the scriptaculos js script directally but wasnt sure how to proceed. any help would be greatly appreciated. Adam -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Have you tried starting with in_place_edit_for in your controller, rather than configuring the url and action manually? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Carl Johnson wrote:> Have you tried starting with in_place_edit_for in your controller, > rather than configuring the url and action manually?Yes i tried that with the in_place_edit_field. the problem is that im using restful only routes so there is no way for the action that is added by in-place_edit_for to be accessed. Also, im using a partial which isnt playing well with the in_place_edit_field. There is a problem with variable scope, the id cant be found and ive had to add an ugly work around, which from memory is like the code below: <% @track = track %> i like the concept of restful apps but when things like this come up it seems like a pain. should i perhaps add a non restful named route? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m using in_place_editor_for with RESTful routes without a problem. Need more details on what issues you are seeing. If I recall, the action generated by in_place_editor_for was not really RESTful, but I didn''t really care that much since AJAX URLs aren''t seen anyway.> Also, im using a partial which isnt playing well with the > in_place_edit_field. There is a problem with variable scope, the id cant > be found and ive had to add an ugly work around, which from memory is > like the code below: > > <% @track = track %>Yup this is a known issue, I had to do the same thing. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Carl Johnson wrote:> I''m using in_place_editor_for with RESTful routes without a problem. > Need more details on what issues you are seeing. If I recall, the action > generated by in_place_editor_for was not really RESTful, but I didn''t > really care that much since AJAX URLs aren''t seen anyway. > >> Also, im using a partial which isnt playing well with the >> in_place_edit_field. There is a problem with variable scope, the id cant >> be found and ive had to add an ugly work around, which from memory is >> like the code below: >> >> <% @track = track %> > > Yup this is a known issue, I had to do the same thing.Hey carl, thanks for your reply. I managed to get around the above ugly fix by using the in_place_edit control. Note, you do need the simplyhelpful plugin for the dom_id helper. Ok, so details of the problem im having, with in_place_editor and restful routes. When i click on the ok button from the in_place_editor i get an alert type error suggesting that there is no route available. What routes do you have configured to accept the ajax request? Do you have the following included in your routes: map.connect '':controller/:action/:id'' ? If i alter the named route from track_path(track) to tracks_path it gets to the create method. So it appears to be a problem with the lack of a put. It would be nice to no be restful for these ajax items some times though. For example i mentioned auto_complete today and now is a requirement, nice one!! These also fail under similar circumstances (no route found etc) =========================VIEW CODE START <span id="<%= "#{dom_id(track)}_artist" %>"><%= track.artist %></span> <%= in_place_editor "#{dom_id(track)}_artist", {:url => url_for(track_path(track)), :method=>:put} %> =========================VIEW CODE END =========================ERROR START The page at http://0.0.0.0:3000 says: . . . error communicating with the server Action controller :exception caught Routing Error no route found to match "e;/tracks/17& quote; with {:method=&=gt;:post} =========================ERROR END =========================ROUTES START ActionController::Routing::Routes.draw do |map| map.resources :tracks, :prices, :attachments map.connect '''', :controller => "releases" end =========================ROUTES END -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> <span id="<%= "#{dom_id(track)}_artist" %>"><%= track.artist %></span> > <%= in_place_editor "#{dom_id(track)}_artist", {:url => > url_for(track_path(track)), :method=>:put} %>Don''t specify :url at all. Take it out, and put in_place_edit_for at the top of the view''s controller. That''s the basic in_place_editing functionality... I would start by seeing if that works (it''s all I did for mine). Carl -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Carl Johnson wrote:> >> <span id="<%= "#{dom_id(track)}_artist" %>"><%= track.artist %></span> >> <%= in_place_editor "#{dom_id(track)}_artist", {:url => >> url_for(track_path(track)), :method=>:put} %> > > Don''t specify :url at all. Take it out, and put in_place_edit_for at the > top of the view''s controller. That''s the basic in_place_editing > functionality... I would start by seeing if that works (it''s all I did > for mine). > > CarlJust to check, does yours read in_place_editor_field or in_place_editor ? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Just to check, does yours read in_place_editor_field or in_place_editorI use in_place_editor_field with :external_control. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
here is the patch: http://dev.rubyonrails.org/attachment/ticket/10055/in_place_editing_should_work_with_csrf_and_rjs.patch also, you can take a look at: http://blog.enjoyrails.com/2008/03/15/in_place_editor-for-rails202/ and http://cookbook.enjoyrails.com/cookbooks/20 Carl Johnson wrote:>> Just to check, does yours read in_place_editor_field or in_place_editor > > I use in_place_editor_field with :external_control.-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---