similar to: Implementing Optimistic Offline Lock - How ?

Displaying 20 results from an estimated 800 matches similar to: "Implementing Optimistic Offline Lock - How ?"

2006 May 09
7
When to use optimistic locking?
Hi All, I''m having some trouble deciding when and how to implement optimistic locking. Let''s say I have a multiuser Rails app, and let''s say it stores, among other things "vital" customer information. The standard methods created by the Rails generate scaffold script look like this: def edit @customer = Customer.find(params[:id]) end
2006 Mar 13
3
unit tests executed for every page load ?
After I installed the very sweet file_column plugin I get strange output on my html pages. At the very end I always get something like this: "Loaded suite dispatch.cgi Started Finished in 0.000218 seconds. 0 tests, 0 assertions, 0 failures, 0 errors " Seems like there is executed a non existent test suite for every page load. Can anybody help me find the lines that force this
2006 Feb 23
7
Session Based Record Locking - Solutions?
All, I''ve written a simple job/opportunity tracking database app via RoR. I have about 10 internal users. Sometimes 2 people will want to update the same record at more or less the same time and they collide. In particular user 1 may edit a record, then get distracted, and finally an hour later they click save. During that hour user 2 may have pulled up the record, edited it, and
2006 Jan 04
2
Rename lock_version field?
Hi, Is there a way to tell Rails that the magic field name for optimistic database locking is not lock_version? I have a legacy database where the optimistic locking field is named "version". Thanks, Phil -- Posted via http://www.ruby-forum.com/.
2009 Aug 10
1
[PATCH server] Fixed db-omatic so it doesn't die due to an unhandled ActiveRecord::StaleObjectError exception.
The error is caused by the save! method updating an object that another thread (most likely in taskomatic) already updated. In the case of this race condition, we retry saving. However, a proper fix would involve fixing the locking. --- src/db-omatic/db_omatic.rb | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/db-omatic/db_omatic.rb
2009 May 19
4
proper way to ensure atomic model changes
Hi! Say we have a rails active-record-based model called "instance" which can have different states - STOPPED, RUNNING, STARTING_UP, SHUTTING_DOWN, etc... There is a method #start which changes the instance state to STARTING_UP only if it is STOPPED. def start if self.state == STOPPED self.state = STARTING_UP self.save ... end end As you understand if we have multiple
2008 Feb 08
2
update_Attributes stale Object error
Hi, IN one of my unit tests I get an ActiveRecord::StaleObjectError: Attempted to update a stale object object.save! in object I have apart from other stuff an after_save method, which calls object.assosication.update_attributes(...) If I remove that line from my code my tests succeeds. Unfortunetly, I do not understand why an update_attributes call can generate an StaleObjectError. Maybe
2006 Jun 07
9
Unobtrusive Javascript for Rails
I made a brief post on here the other day about this and now I can proudly present the initial release of our unobtrusive_javascript plugin for Rails. We''ll be working with Dan Webb of Vivabit to roll in much of the functionality in his own as-yet unreleased unobtrusive_javascript plugin into a single plugin. This is essentially a preview release and probably not suitable for use on a
2013 Feb 25
7
Optimistic Locking Enhancements: Gem or Core?
I''m working on an app that makes use of rails'' optimistic locking feature and seeing some possibilities for improvements. It seems a bit tedious to have to add :lock_version to forms wherever the model is used. You also have to "hack" around rails'' UJS feature to add it as a URL parameter when using remote: true, method: [:put, :patch, :post, :delete].
2007 Mar 25
1
Optimistic locking and update_attributes: not working?
Hi all, I''ve searched the forumns, but I can''t seem to find an answer to this one. I''m having trouble getting optimistic locking (OL) to work in my app, even though all of the pieces are there: * table has lock_version column, with default of 0 (zero) * lock_version column is being incremented by the first update (but the second doesn''t catch it) *
2006 May 09
5
Shared Queue / Exclusive Query Results
My application is going to have a work queue of scheduled tasks stored in the DB. This work queue will be shared across multiple Rails app servers. I need a way to ensure that no two servers get the same jobs if multiple servers pop jobs off the top of the queue simultaneously. Is there a fairly simple way to acheive this? Or do I need to come up with some fancy secondary server to dispatch
2006 Jan 12
9
Scaffold shows all attributes altough I use attr_accessible!
Hi all I have a Model like this: class Member < ActiveRecord::Base attr_accessible :username, :email, :first_name, :last_name end I have created a scaffold using script/generate scaffold member members Using the URL localhost:3000/members/edit/1 I can edit all attributes, including created_at, lock_version etc.! But it should only show the attributes I listed in attr_accessible! What
2008 Jul 31
2
Freeze field in active record
Hello, I have a freeze field in a table (that I can''t change). When I try to find a record in this table I have the exception : C:/DATA/InstantRails-2.0/ruby/lib/ruby/gems/1.8/gems/ activerecord-2.1.0/lib/active_record/attribute_methods.rb:104:in `instance_method_already_implemented?'' C:/DATA/InstantRails-2.0/ruby/lib/ruby/gems/1.8/gems/
2006 Jul 06
4
update_all Not Incrementing lock_version
Shouldn''t update_all be updating lock_version? As you can see from my console session below, it is upating the record (changed running attribute to true and returned 1 to show 1 recored was updated). But it did not increment lock_version. And optimistic locking is working correctly otherwise. As you can see below, lock version = 562 before and after the update_all call but it is
2006 Jan 22
6
*Very* basic layout question
I''m trying to use a different layout for just one action in my controller, all the other actions use the application.rhtml layout, so what i''m doing is ... class SomeController < ApplicationController layout "simple", :only=> :some_action ...... end and the "simple" layout is applied to all the actions, can someone please give me a hint?
2006 Apr 10
1
routing
I have this in my routes.rb: ... map.connect ":action/:id", :controller => "default_controller" .. It worked nicely, until I added a second controller to my project. The new (second) controller is "Admin". The problem is I cant reach the actions in the second controller. http://mysite.com/some_action is routed to some_action in default_controller. That is
2008 Feb 28
5
JDF library in wine?
Hello all, I wonder if there is a way to set up the so-called JDF library required by several Adobe software? I haven't been able to find out what it is, nor whether wine has any way to set this up, or even if I can copy windows DLL's over. I can get Adobe Acrobat 7.0 to run, for example, but many actions fail with the error "cannot initialize JDF library". Any enlightenment
2008 Oct 21
1
How to force a lock_version increment
Hi everyone, I have a order with order_lines use case. On changing the lines, I want to be sure no one else changed the order. So I use lock_version on the order. This works fine if something is changed on the order record. But now i have the situation that I delete, alter and add order lines without changing the order record itself. I have to check and increment the order#lock_version however
2006 May 17
6
ActiveRecord#to_param
Hello, to implement some some kind of optimistic locking, I want to build a view, where an object is displayed together with a link containing the data of the displayed object. My first try looked something like <%= object.object_discription %> <%= link_to "action", :action => "take_action", :data => object %> this won''t work because object is of
2015 Jul 15
3
Question about NUT-Monitor
I have just recently gotten NUT to work on my system, with much assistance from Charles Lepple, and am very?grateful for his assistance. ? I now have a question regarding the NUT-Monitor program. ?There is a tool in the GUI that is for sending devicecommands. ?I can't get it to work. ?Whenever I try to send a command I get the following message: Failed to send <command> ?(ERR USERNAME