Commit Graph

47 Commits

Author SHA1 Message Date
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
Xavier Noria
64092de257 Improve documentation coverage and markup
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-05-02 14:45:23 +01:00
David Heinemeier Hansson
c353794dff Fixed that pessimistic locking you reference the quoted table name (Josh Susser) [#67 state:resolved] 2008-04-30 15:04:08 -05:00
Jeremy Kemper
6b9448cdd2 Partial updates include only unsaved attributes. Off by default; set YourClass.partial_updates = true to enable.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9157 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-31 01:10:04 +00:00
Rick Olson
ce102e3af9 Ensure optimistic locking handles nil #lock_version values properly. Closes #10510 [rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8395 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-15 01:45:30 +00:00
Jeremy Kemper
473202df83 attr_readonly behaves well with optimistic locking. Closes #10188.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8156 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-11-16 20:31:24 +00:00
Jeremy Kemper
c4a31560bd Optimistic locking: revert the lock version when an update fails. Closes #7840. Also return the number of affected rows instead of true.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6843 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-05-25 21:31:44 +00:00
Marcel Molina
194b4aa4f3 Provide brief introduction to what optimistic locking is. Closes #8097. [fearoffish]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6682 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-05-06 05:01:31 +00:00
Jeremy Kemper
07d8f46b85 Consistent public/protected/private visibility for chained methods. Closes #7813.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6396 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-03-13 02:14:31 +00:00
Jamis Buck
83752373b9 Made increment_counter/decrement_counter play nicely with optimistic locking, and added a more general update_counters method
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6139 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-02-07 16:10:40 +00:00
Rick Olson
1a11bffde1 Don't create instance writer methods for class attributes. Closes #7401 [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6051 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-01-28 01:31:31 +00:00
David Heinemeier Hansson
85fbb22f07 Backed out of new_record? to new? transformation as it would screw up existing models that did boolean calls on "new" attributes [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5018 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-09-05 18:54:24 +00:00
David Heinemeier Hansson
9d7e6432b2 Deprecated ActiveRecord::Base.new_record? in favor of ActiveRecord::Base.new? (old version still works until Rails 2.0) [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5017 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-09-05 18:48:10 +00:00
Michael Koziarski
b445ab986a Rename quote to quote_value so the name can be used in AR models. #3628 [Koz]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5007 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-09-04 23:41:13 +00:00
Jeremy Kemper
528618a910 Optimistic locking: gracefully handle nil versions, treat as zero. Closes #5908.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4958 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-09-04 00:02:38 +00:00
Jeremy Kemper
722e0b6a8b r4664@asus: jeremy | 2006-06-19 18:55:36 -0700
Use the #lock method to obtain a row lock on a single record. Simply reloads the record with :lock => true.


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4462 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-06-20 01:58:36 +00:00