search for: lock_version

Displaying 20 results from an estimated 50 matches for "lock_version".

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 be...
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 in advance. If I do this: @order.update_attribute...
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/.
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]. On the controller side in rails 4 (or if you''re just using the strong_parameters gem...
2006 May 17
0
acts_as_versioned with lock_version bug?
Hello. The acts_as_versioned plugin works fine ... till the adjunction of optimistic locking via the lock_version table column. Here is the problem description: Without optimistic locking things are fine: # ++++ The table creation migration ++++ % cat db/migrate/001_create_tables.rb class CreateTables < ActiveRecord::Migration def self.up create_table :softwares, :force => tr...
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
2007 Jul 31
0
Force an object to previous state, when using lock_version
If I have an exception while trying to save an object, how can I tell Rails that it''s not saved yet? The object has a lock_version (used for optimistic locking). This is what I do: ins = MyClass.new( arguments ) begin transaction do ins.save! bunch_of_other_stuff() end rescue ins.save! # problem here! end The object''s save() sets the internal object state in a saved mode. It actually isn''t saved b...
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
2012 Nov 12
3
Updating objects in arrays
...nd update an attribute. When I do this the underlying table row changes but the object in the array frequently does not. For example: count = 0 current_entries.each do |entry| puts( entry.object_id ) puts( current_entries[count].object_id ) puts( "***" ) puts( entry.lock_version ) entry = set_customs_entry_status_for( entry, status ) puts( entry.lock_version ) current_entries[ count ] = entry puts( current_entries[ count ] = entry ) end gives: 58380880 58380880 *** 0 5 5 58378260 61590300 *** 0...
2006 Jan 06
0
[PATCH] [3402] Allow lock_version column name to be configured.
My first stab at the whole metaprogramming / DSL thing. Fun stuff. Includes unit tests, fixtures, etc, etc. Tested against Oracle and PostgreSQL so far. I''d appreciate it if some MySQL folks could try it out. Hopefully I got the MySQL CREATE TABLE syntax correct. http://dev.rubyonrails.org/ticket/3402 Assuming this kind of thing is OK, I''d like to make
2006 Jan 12
9
Scaffold shows all attributes altough I use attr_accessible!
...l 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 is wrong here? Thanks for help. Josh -- Posted via http://www.ruby-forum.com/.
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
2010 Sep 22
0
ActiveRecord#touch behaviour in Rails 3
In Rails 2.x, calling touch on an ActiveRecord model would update the ''lock_version'' on the model, if it were present. It would produce something like this in SQL: UPDATE `foo` SET `updated_at` = ''2010-07-23 10:44:19'', `lock_version'' = 2 WHERE ''lock_version'' = 1 This would ensure that your optimistic locking policy will be f...
2005 Apr 04
10
Encrypted ASP.Net type viewstate
Does rails have any builtin functionality similar to that of ASP.Net''s encryptable ViewState? For those that don''t know what the ASP.Net viewstate is, it is essentially just a hidden form field with the name __VIEWSTATE, that stores a series of encoded(or encrypted) key/value pairs as it''s value. When the form is submitted the viewstate value is decoded/decrypted on the
2008 Jan 15
6
SQLite concurrency, SQLite3::BusyException
...by/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/abstract_adapter.rb:150:in `log'': SQLite3::BusyException: database is locked: UPDATE people (ActiveRecord::StatementInvalid) SET "name" = ''Michael'', "lock_version" = 16 WHERE id = 1 AND "lock_version" = 15 from C:/test/lib/person_updator.rb:18:in `join'' from C:/test/lib/person_updator.rb:18:in `start'' from (eval):1 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_...
2006 Jan 20
2
The New Memcache ?
Hey All ! I ended up browsing to Eric Hodel''s blog the other night, and found his entry about the new cache_model and memcache-client. Now, it looks like it''s "officially" out in the open: http://weblog.rubyonrails.com/articles/2006/01/20/caching-models-with-memcached In my application, I''ve been staying away from caching my models, and instead just doing
2010 Jan 21
2
nested forms and attr_accessable
Rails 2.3.5 I am working on a nested form that assigns roles to users through a table called clearances. I have attr_acessable turned off globally in an initializer: ActiveRecord::Base.send(:attr_accessible, nil) I have this set in clearance.rb attr_accessible(:description, :effective_from, :role_id, :superceded_after, :user_id) And this is what params looks like after the
2007 Dec 17
3
not able to view the images after the upload
...el is as below.. class Entry < ActiveRecord::Base require ''remote_uploads.rb'' file_column :image, :magick => { :versions => { "thumb" => "50x50" } } def self.content_columns filter = %w(created_on updated_on lat lon image lock_version) super.reject {|c| filter.include? c.name} end end Thanks.. -- 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 gro...
2006 Jun 05
0
migration to be called inside others migrations
...ns and the columns updated_at to be added etc... Now since the rails related columns will be the same for many (but not all) tables I was thinking... can I write a Migration that sounds like that class AddRailsFields < ActiveRecord::Migration def self.up(tbname) add_column tbname, "lock_version", :integer, :default => 0 rename_column tbname, "oldtimestamp", "updated_at" end def self.down(tbname) remove_column tbname, "lock_version" rename_column tbname, "updated_at", "oldtimestamp" end end And call it inside ot...
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) * I''m trapping for ActiveRecord::StaleObjectError, but it is never thrown But nothing seems to work. Note that currently, I''m still in devel...