Vijay wrote:
> I'm newbie to ruby on rails.
> In my application, i was trying to show the remaining time the user is
> allowed to edit an instance record( like milestones, cheklists etc.).
> I was locking it from multiple users to edit it at the sametime.
> When the user clicks the edit link_to i need to display the timer in
> the edit.rhtml

I thought for a second about attempting to answer this, but quickly 
realized. DO NOT DO THIS!

Pessimistic locking on databases is very, very bad form. Do not attempt 
to prevent concurrent editing. You're just asking for trouble. Users of 
modern applications will not accept pessimistic style record locking.

Instead, develop a recovery solution based on an optimistic locking 
scheme. ActiveRecord has some built-in support for optimistic locking, 
which will get you started. If the optimistic locking mechanism detects 
concurrent edits then present that to the user with enough information 
to recover.

P.S. Using *.rhtml extensions is so one-dot-ex.  If you're using a 
version of Rails 2.0 or higher, switch your views to use *.html.erb.
-- 
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 [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