Displaying 20 results from an estimated 600 matches similar to: "update_all Not Incrementing lock_version"
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 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/.
2006 Jun 01
2
update_all broken in postgres?
Hi
has anyone managed to use update_all with rails on postgres?
In my setup, it does not work:
>> @keyword.update_all(myupdates)
NoMethodError: undefined method `update_all'' for #<Keyword:0xb7ac4670>
from
/home/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1786:in
`method_missing''
from (irb):14
I checked that the base.rb
2010 Jul 14
1
ActiveRecord::Observer, update_all and has_many
Hi,
I''m using an ActiveRecord::Observer to log users changing data in my
application. However, I''ve noted that adding an item to a has_many
relationship gets logged, but removing the item does not. That is:
@product.users << user
is logged, but:
@product.users.delete(user)
is not.
I''ve dug into ActiveRecord and found that the underlying issue is that
the
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,
2007 Jul 12
0
update_all for an AR instance
Is there anyway to call "update_attributes" where it updates only the
attributes you specify with the update command.
The only thing close to this is update_all where you have to specify the
condition. So essentially you''d be stuck doing "id=#{obj.id}" as the
condition.
Are there any built in AR functions that allow you to update a
particular object using straight
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
2008 Jul 02
3
update_all not changing updated_at
Hi everyone-
Model.update_all works and changes the records, but it''s not changing
the updated_at field. Am I doing something wrong or is this by
design?
Thanks,
Dino
--~--~---------~--~----~------------~-------~--~----~
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
2005 Nov 30
0
Passing variables with update_all
I''d like to produce an SQL update along the lines of:
UPDATE companies SET category2={newcategory} WHERE (category2 =
{oldcategory})
At the moment I''ve got:
ctype = params[:ctype]
Company.update_all("category2=ctype", "category2=ctype")
At present this returns a StatementInvalid:
Unknown column ''ctype'' in ''where clause'':
2012 Nov 12
3
Updating objects in arrays
Perhaps this is a Rails issue. However, I need to first determine whether
I simply am missing something about updating members of an array.
I have an array of 10 ActiveRecord objects. I wish to iterate over the
array and 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
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 Feb 22
0
Problem with Cacti and CentOS 4.4
I just for the first time attempted to install Cacti from the RPMForge
repo on CentOS 4.4.
And I have to say that it hasn't gone very well at all. I have installed
Cacti on Fedora a good 20 times with absolutely no problem.
Basically the default rrds/graphs for localhost are generated but no other
rrds/graphs are generated.
When I look at the poller cache or snmp cache I see all the data.
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
2007 Sep 07
6
ActiveRecord::Base#update_all expected behaviour
Hi
I noticed that if in my code I use the following:
Photo.update_all("title = ''Ruby rocks'' ", "id IN (#{@photo_ids})")
All my objects are properly updated but none of the filters/callbacks
are triggered. Is that what''s expected?
I have a before_update filter set on the Photo class and it gets
totally ignored, I guess the only way to solve this
2008 Jan 15
6
SQLite concurrency, SQLite3::BusyException
I am currently experiencing concurrency issues after moving from MySQL
to SQLite.
My original program worked fined using MySQL but is now returning
"SQLite3::BusyException" errors. The same result happens whether or
not I enable the allow_concurrency flag.
If I do manually acquire a lock on the SQLite DB the problem would
disapear, but I thought that rails was supposed to handle this
2007 Dec 17
3
not able to view the images after the upload
hi,
i have this problem where in i''m able to upload the images using
file_column
to the server but i''m not able to view the images.i''m not able to see
the images
but then i''m able to view the image name when i click on my show action.
can any one please help??
THIS IS MY LOG as to what happens when i do the image upload.
Processing UploadController#create
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 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 May 31
1
Help enhancing acts_as_nested_set
I''m trying to enhance acts_as_nested_set. Well actually I already have,
but I''ve done a hack up job of it. I would like to contribute these
enhancements back, but I need a little help.
I''m a complete newbie to this stuff. The only thing I new before coming
into this project was vanilla HTML. So over the course of two weeks I''ve
picked up Ruby, Rails, MySQL,
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