If I am in a form and I am editing it and I have a status of say "being edited". If someone were to navigate away say to show all forms or something is there a way to update the state of the form? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Me wrote:> If I am in a form and I am editing it and I have a status of say > "being edited". If someone were to navigate away say to show all > forms or something is there a way to update the state of the form?That is generally not what a state machine is for. Your states should have a wider granularity, and users should push records into new states by explicitly submitting forms. Even if you wrote an Ajax call in the "onblur" event of your form (if there is one), and even if the user''s browser did not reject the call as an attempt to pop up an ad, your user might simply unplug from the grid suddenly. To prevent users from editing the same record, do what Wikis do. Send out one form with a timestamp. When the POST comes back, compare the timestamp to the record''s current stamp. If it has changed, inform the user they should use the Back button to retrieve their changes, they should copy them out to a Notepad, and then they should refresh their record to see the latest version. -- Phlip http://flea.sourceforge.net/resume.html --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
OK, I have a status called "being_edited when a record is being updated. When this happens I removed the ability to edit the record from the SHOW screen. Ok so I guess if in the edit screeen do not have a navigation link? On Fri, Apr 17, 2009 at 7:28 PM, Phlip <phlip2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Me wrote: > > If I am in a form and I am editing it and I have a status of say > > "being edited". If someone were to navigate away say to show all > > forms or something is there a way to update the state of the form? > > That is generally not what a state machine is for. Your states should have > a > wider granularity, and users should push records into new states by > explicitly > submitting forms. > > Even if you wrote an Ajax call in the "onblur" event of your form (if there > is > one), and even if the user''s browser did not reject the call as an attempt > to > pop up an ad, your user might simply unplug from the grid suddenly. > > To prevent users from editing the same record, do what Wikis do. Send out > one > form with a timestamp. When the POST comes back, compare the timestamp to > the > record''s current stamp. If it has changed, inform the user they should use > the > Back button to retrieve their changes, they should copy them out to a > Notepad, > and then they should refresh their record to see the latest version. > > -- > Phlip > http://flea.sourceforge.net/resume.html > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Phlip wrote:> To prevent users from editing the same record, do what Wikis do. Send > out one > form with a timestamp. When the POST comes back, compare the timestamp > to the > record''s current stamp. If it has changed, inform the user they should > use theIs there some reason to go through all this trouble with using timestamps? Why not just use optimistic locking? I''m not saying this isn''t necessary, I''m actually curious of any advantage of using timestamps. -- 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 -~----------~----~----~----~------~----~------~--~---
Robert Walker wrote:> Phlip wrote:>> To prevent users from editing the same record, do what Wikis do. Send >> out one >> form with a timestamp. When the POST comes back, compare the timestamp >> to the >> record''s current stamp. If it has changed, inform the user they should >> use the> Is there some reason to go through all this trouble with using > timestamps? Why not just use optimistic locking? I''m not saying this > isn''t necessary, I''m actually curious of any advantage of using > timestamps.Fail open instead of fail closed? But I am more concerned about Chris''s reply - I can''t figure out the question... --~--~---------~--~----~------------~-------~--~----~ 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 just do this in my application.html page: <% unless @mop.state.eql?("Being_Edited") %> <%= link_to "New Mop", :action => "new" %></h3></td> <%= link_to "Review Mop", :action => "review" %></h3></td> <% end %> Same thing really for the Show page, I just put an unless condition to remove the "edit" link if the mop is being edited or looked at. On Fri, Apr 17, 2009 at 7:54 PM, Phlip <phlip2005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Robert Walker wrote: > > > Phlip wrote: > > >> To prevent users from editing the same record, do what Wikis do. Send > >> out one > >> form with a timestamp. When the POST comes back, compare the timestamp > >> to the > >> record''s current stamp. If it has changed, inform the user they should > >> use the > > > Is there some reason to go through all this trouble with using > > timestamps? Why not just use optimistic locking? I''m not saying this > > isn''t necessary, I''m actually curious of any advantage of using > > timestamps. > > Fail open instead of fail closed? > > But I am more concerned about Chris''s reply - I can''t figure out the > question... > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Chris Habgood wrote:> I just do this in my application.html page: > > <% unless @mop.state.eql?("Being_Edited") %> > <%= link_to "New Mop", :action => "new" %></h3></td> > <%= link_to "Review Mop", :action => "review" %></h3></td> > <% end %> > > Same thing really for the Show page, I just put an unless condition to > remove the "edit" link if the mop is being edited or looked at.As a View style thing, a button should not just disappear if it wouldn''t have worked. Let the user click on the button, then provide a timely error message. How about you disable the link (make it grey, not <a>), and then put a message next to it "Asok started editing this at 3:11"? Can someone think of a way to do that, with a command override if Asok went home and left his browser running? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Phlip wrote:> Chris Habgood wrote: > >> I just do this in my application.html page: >> >> <% unless @mop.state.eql?("Being_Edited") %> >> <%= link_to "New Mop", :action => "new" %></h3></td> >> <%= link_to "Review Mop", :action => "review" %></h3></td> >> <% end %> >> >> Same thing really for the Show page, I just put an unless condition to >> remove the "edit" link if the mop is being edited or looked at.What prevents the user from typing the url by hand to edit the action? Then you''d have two users with the same form in the edit state. I don''t think hiding the link is really preventative. Cheers, Darrik -- Darrik Mazey DMT Programming, LLC. P.O. Box 91 Torrington, CT 06790 office: 330.983.9941 fax: 330.983.9942 mobile: 330.808.2025 darrik-hYmAEBE3lWIoJ/VrfD3uVNBPR1lH4CV8@public.gmane.org To obtain my public key, send an email to darrik-3ZOItiUs85ODFug2jf9dzoDEJ8dgO5X3FNOCUTQkUI4@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Nothing really but the people who use this will most likely not know how to do that. Is there a better way to prevent someone from editing a form while someone else has it open? I saw something about optimistic locking but not quite sure what it really is or how to use it. On Fri, Apr 17, 2009 at 10:55 PM, Darrik Mazey <darrikmazey-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> > Phlip wrote: > > Chris Habgood wrote: > > > >> I just do this in my application.html page: > >> > >> <% unless @mop.state.eql?("Being_Edited") %> > >> <%= link_to "New Mop", :action => "new" %></h3></td> > >> <%= link_to "Review Mop", :action => "review" %></h3></td> > >> <% end %> > >> > >> Same thing really for the Show page, I just put an unless condition to > >> remove the "edit" link if the mop is being edited or looked at. > > What prevents the user from typing the url by hand to edit the action? > Then you''d have two users with the same form in the edit state. I don''t > think hiding the link is really preventative. > > Cheers, > Darrik > > -- > Darrik Mazey > DMT Programming, LLC. > P.O. Box 91 > Torrington, CT 06790 > office: 330.983.9941 > fax: 330.983.9942 > mobile: 330.808.2025 > darrik-hYmAEBE3lWIoJ/VrfD3uVNBPR1lH4CV8@public.gmane.org > > To obtain my public key, send an email to > darrik-3ZOItiUs85ODFug2jf9dzoDEJ8dgO5X3FNOCUTQkUI4@public.gmane.org > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---