Alfred Wong
33e1604b3e
Specified column type for quote_value
...
When calling quote_value the underlying connection sometimes requires
more information about the column to properly return the correct quoted
value.
I ran into this issue when using optimistic locking in JRuby and the
activerecord-jdbcmssql-adapter. In SQLSever 2000, we aren't allowed to
insert a integer into a NVARCHAR column type so we need to format it as
N'3' if we want to insert into the NVARCHAR type. Unfortuantely, without
the column type being passed the connection adapter cannot properly return
the correct quote value because it doesn't know to return N'3' or '3'.
This patch is fairly straight forward where it just passes in the column
type into the quote_value, as it already has the ability to take in the column,
so it can properly handle at the connection level.
I've added the tests required to make sure that the quote_value method
is being passed the column type so that the underlying connection can
determine how to quote the value.
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/locking/optimistic.rb
2013-07-24 13:18:21 -03:00
Nick Rogers
05e1466e05
Fix deleting from a HABTM join table upon destroying an object of a model with optimistic locking enabled. Fixes #5332 .
2012-11-13 10:36:24 -08:00
Aaron Patterson
c470001891
Merge pull request #5810 from kennyj/fix_5797
...
Fix #5797 . Error calling dup method on AR model with serialized field
Conflicts:
activerecord/lib/active_record/core.rb
2012-05-30 15:50:24 -03:00
Aaron Patterson
4c5b73fef8
Merge pull request #4531 from exviva/pessimistic_with_lock
...
Add ActiveRecord::Base#with_lock
2012-01-19 09:39:20 -08:00
Jon Leighton
7edade337e
Make read_attribute code path accessible at the class level
2011-12-22 19:24:16 +00:00
Jon Leighton
7b0edbb9f2
Avoid super; speeds up Model.new by about 12%
2011-12-14 16:14:47 +00:00
Jon Leighton
f3c84dc316
Deprecate set_locking_column in favour of self.locking_column=
2011-11-29 20:13:37 +00:00
Joost Baaij
80bcfb00f7
Added a note that optimistic locking also needs a hidden field to function across web workers.
2011-10-25 13:57:24 +03:00
Christian Bäuerlein
c6f0461e89
Consider attempted action in exception message of ActiveRecord::StaleObjectError
2011-10-14 18:20:41 +02:00
Christian Bäuerlein
410fa4cf7c
Includes stale record in StaleObjectError
2011-10-14 16:28:02 +02:00
Jon Leighton
7db90aa7c7
Make it the responsibility of the connection to hold onto an ARel visitor for generating SQL. This improves the code architecture generally, and solves some problems with marshalling. Adapter authors please take note: you now need to define an Adapter.visitor_for method, but it degrades gracefully with a deprecation warning for now.
2011-08-08 23:28:23 +01:00
Aaron Patterson
13e79eb6c3
lock_optimistically is typically true, so evaluate the common failure case first
2011-06-28 10:51:23 -07:00
John Paul Ashenfelter
3b18e900e8
Closes GH #1032
...
Fixed what looks like minor cut/paste error in documentation for ActiveRecord::Locking:Pessimistic
2011-05-19 01:20:26 -04:00
Sebastian Martinez
84e541ecb4
Better doc styling in ActiveRecord::Locking
2011-05-17 20:21:35 -03:00
Christopher Meiklejohn
4fbd8adf48
Don't quote ID's as Arel will quote them -- follow same conventions as the delete method.
2011-05-08 18:37:28 +01:00
Paco Guzman
0a51e43866
remove some blanks
2011-03-11 23:08:55 +01:00
Sergii Boiko
471327169d
fixed broken link to postgresql docs
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2011-02-15 12:01:15 -02:00
Josh Kalderimis
9d8fdfec38
removed some duplication from LH issue 5505 regarding AR touch and optimistic locking [ #5505 state:resolved]
...
Signed-off-by: Santiago Pastorino and José Ignacio Costa <santiago+jose@wyeworks.com >
2011-02-09 18:28:15 -02:00
Aaron Patterson
8c9b5e413f
removing more calls to deprecated methods
2010-12-02 15:07:01 -08:00
Emilio Tagua
1b6b80355c
Remove explicit return.
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2010-11-25 17:33:18 -02:00
Emilio Tagua
c4d31d0f13
Reuse lock_col variable instead calling locking_column class method.
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2010-11-25 17:32:16 -02:00
Emilio Tagua
d29d793c90
Don't create local vars.
2010-11-24 01:37:01 +08:00
David Chelimsky
1f06652a57
use persisted? instead of new_record? wherever possible
...
- persisted? is the API defined in ActiveModel
- makes it easier for extension libraries to conform to ActiveModel APIs
without concern for whether the extended object is specifically
ActiveRecord
[#5927 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2010-11-09 13:54:04 -02:00
Emilio Tagua
32e296b6ff
Use new finders syntax in docs.
2010-09-01 12:16:08 -03:00
Jacob Lewallen
d10ecfefb8
Set destroyed=true in opt locking's destroy [ #5058 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-07-14 08:02:17 +02:00
Pratik Naik
475d1d1713
Use arel instead of sql strings
2010-05-11 15:32:41 +01:00
wycats
d916c62cfc
eliminate alias_method_chain from ActiveRecord
2010-05-09 02:37:52 +03:00
Curtis Hawthorne
7e06494e32
Destroy respects optimistic locking.
...
Now works with :dependent => :destroy and includes unit tests for that
case. Also includes better error messages when updating/deleting stale
objects.
[#1966 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-04-27 21:53:51 -07:00
Pratik Naik
8b9bfbe225
Dont delegate Relation#update to arel
2010-01-20 19:01:26 +05:30
Pratik Naik
dbce07b81d
Give preference to to_a over arel from Relation#method_missing
2010-01-19 22:52:08 +05:30
Pratik Naik
cd90dcb1bd
Rename Model.active_relation to Model.unscoped
2010-01-17 03:00:56 +05:30
Pratik Naik
b35873a575
Rename Model.arel_table to Model.active_relation
2010-01-02 00:25:29 +05:30
Pratik Naik
fc94c03c1d
Remove unncessary arguments passed to arel_table
2010-01-01 23:34:15 +05:30
Jeremy Kemper
fb61fbd352
Revert "Ensure Model#destroy respects optimistic locking"
...
[#1966 state:open]
This reverts commit 0d922885fb .
Conflicts:
activerecord/lib/active_record/locking/optimistic.rb
2009-11-17 15:35:35 -08:00
Emilio Tagua
24260dc0c8
Merge commit 'rails/master'
2009-09-14 09:47:55 -03:00
Shugo Maeda
ff2eb2d808
Removed the copyright notice not to show it in the result of 'ri ActiveRecord'.
2009-09-11 15:33:20 -07:00
Emilio Tagua
fefb4c78ac
Cache arel_table when possible, use class method arel_table instead
...
instance method.
2009-08-18 16:28:04 -03:00
Emilio Tagua
ca1e62f142
Performance: cache/reload arel relation when possible to speed up things.
2009-07-21 23:01:26 -03:00
Emilio Tagua
fd3c55f09f
Merge commit 'rails/master'
...
Conflicts:
activerecord/lib/active_record.rb
2009-06-02 12:36:36 -03:00
Joshua Peek
4e50a35fa2
Break up DependencyModule's dual function of providing a "depend_on" DSL and "included" block DSL into separate modules. But, unify both approaches under AS::Concern.
2009-05-28 11:35:36 -05:00
Emilio Tagua
0048897a41
Merge commit 'rails/master'
2009-05-12 16:13:00 -03:00
Bryan Helmkamp
a2875bec9a
Use DependencyModule for included hooks in ActiveRecord
2009-05-11 22:23:47 -04:00
Emilio Tagua
3fd467e9ed
Refactor to use arel_table method, and also use the same method name for instance and class methods.
2009-05-02 04:02:09 -03:00
Emilio Tagua
c9896884a4
Removed ARel table assignment
2009-05-02 03:40:31 -03:00
Emilio Tagua
5b61168aaf
Added arel_attributes_values methods, refactored locking and AR#update to use this method
2009-04-30 13:21:13 -03:00
Emilio Tagua
0e113a040d
Refactored locking update
2009-04-24 17:32:16 -03:00
Emilio Tagua
345e686d83
Changed locking to use Arel. Arel updated
2009-04-24 17:27:05 -03:00
Curtis Hawthorne
0d922885fb
Ensure Model#destroy respects optimistic locking [ #1966 state:resolved]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2009-03-09 14:56:09 +00:00
Daniel Morrison
3610997ba3
Partial updates don't update lock_version if nothing changed. [ #426 state:resolved]
2008-06-22 20:33:43 -07:00
Pratik Naik
98dc582742
Merge docrails.
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2008-05-25 12:29:00 +01:00