aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/locking
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove the unused second argument to `substitute_at`Sean Griffin2014-11-171-1/+1
| | | | Oh hey, we got to remove some code because of that!
* Stop using instance exec for type decoratorsSean Griffin & Sean Doyle2014-06-271-5/+16
| | | | | | | | We are moving this behavior out to an object that we would like to keep separated from `ActiveRecord::Base`, which means not passing the class object to it. As such, we need to stop using `instance_exec`, and instead close over the subclass on global type decorators that are applied in `Base`.
* add missing `:nodoc:` for recent refactorings. [ci skip]Yves Senn2014-06-241-1/+1
| | | | | | | | | | Adding `# :nodoc:` to the parent `class` / `module` is not going to ignore nested classes or modules. There is a modifier `# :nodoc: all` but sadly the containing class or module will continue to be in the docs. /cc @sgrif
* Don't mess with `column_defaults` when optimistic locking is enabledSean Griffin2014-06-171-10/+23
|
* Remove deprecated method ActiveRecord::Base.quoted_locking_columnAkshay Vishnoi2014-06-101-6/+0
|
* Remove duplicated `@raw_attributes.keys`Sean Griffin2014-06-071-1/+1
| | | | | Reduces the number of things outside of attribute methods that cares about the details of how we store and type cast attributes
* Rename attribute related instance variables to better express intentSean Griffin2014-05-301-1/+1
| | | | | | | | | `@attributes` was actually used for `_before_type_cast` and friends, while `@attributes_cache` is the type cast version (and caching is the wrong word there, but I'm working on removing the conditionals around that). I opted for `@raw_attributes`, because `_before_type_cast` is also semantically misleading. The values in said hash are in the state given by the form builder or database, so raw seemed to be a good word.
* [Active Record] Renamed private methods create_record and update_recordPrathamesh Sonpatki2014-02-201-1/+1
| | | | | | This is to ensure that they are not accidentally called by the app code. They are renamed to _create_record and _update_record respectively. Closes #11645
* pass the pk to compile_updateAaron Patterson2013-11-161-1/+4
|
* [ci skip] avoid deprecation warning in sample codesue4452013-10-181-3/+3
| | | | | Account.find(1, lock: true) -> DEPRECATION WARNING: Passing options to #find is deprecated. Please build a scope and then call #find on it.
* Deprecate unused quoted_locking_column method.kennyj2013-09-241-0/+1
|
* Tidy up the "Specified column type for quote_value" changesBen Woosley2013-07-221-1/+1
| | | | | | This includes fixing typos in changelog, removing a deprecated mocha/setup test require, and preferring the `column_for_attribute` accessor over direct access to the columns_hash in the new code.
* Specified column type for quote_valueAlfred Wong2013-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | | 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.
* Reset @column_defaults when assigning .kennyj2013-07-141-0/+1
|
* Fix word order in documentation for with_lockPedro Fayolle2013-05-301-1/+1
|
* Deprecate #connection in favour of accessing it via the classBen Moss2013-03-091-2/+2
| | | | | This allows end-users to have a `connection` method on their models without clashing with ActiveRecord internals.
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2013-01-091-1/+1
|\ | | | | | | | | Conflicts: guides/source/getting_started.md
| * remove meaningless use of Relation#allAkira Matsuda2013-01-031-1/+1
| | | | | | | | particularly, `all(options)` would warn
* | Rename update_attributes method to update, keep update_attributes as an aliasAmparo Luna + Guillermo Iguaran2013-01-031-1/+1
|/
* 1.9 Syntax related changesAvnerCohen2012-11-101-3/+3
|
* Remove ActiveRecord::ModelJon Leighton2012-10-261-6/+2
| | | | | | | | | | In the end I think the pain of implementing this seamlessly was not worth the gain provided. The intention was that it would allow plain ruby objects that might not live in your main application to be subclassed and have persistence mixed in. But I've decided that the benefit of doing that is not worth the amount of complexity that the implementation introduced.
* Revert "Get rid of the ActiveRecord::Model::DeprecationProxy thing."Jeremy Kemper2012-10-201-1/+1
| | | | This reverts commit 83846838252397b3781eed165ca301e05db39293.
* Get rid of the ActiveRecord::Model::DeprecationProxy thing.Jon Leighton2012-10-191-1/+1
| | | | | | | | | | | | | | | | | I think it's going to be too much pain to try to transition the :active_record load hook from executing against Base to executing against Model. For example, after Model is included in Base, and modules included in Model will no longer get added to the ancestors of Base. So plugins which wish to be compatible with both Model and Base should use the :active_record_model load hook which executes *before* Base gets loaded. In general, ActiveRecord::Model is an advanced feature at the moment and probably most people will continue to inherit from ActiveRecord::Base for the time being.
* The default value can be set once in #column_defaultsJon Leighton2012-08-171-9/+9
| | | | Rather than doing it every time an instance is instantiated.
* Remove instance level quote_value method. This method is private and also ↵kennyj2012-07-141-1/+1
| | | | exists in class method.
* Simplify AR configuration code.Jon Leighton2012-06-151-2/+6
| | | | | Get rid of ActiveModel::Configuration, make better use of ActiveSupport::Concern + class_attribute, etc.
* Fix #5797. Error calling dup method on AR model with serialized fieldkennyj2012-05-301-1/+1
|
* clear up duplication between Persistence#destroy and Locking#destroyJon Leighton2012-03-301-14/+17
|
* Merge pull request #5334 from courtland/masterJon Leighton2012-03-301-0/+2
|\ | | | | Fix deleting from a HABTM join table upon destroying an object of a model with optimistic locking enabled.
| * Fix deleting from a HABTM join table upon destroying an object of a model ↵Nick Rogers2012-03-071-0/+2
| | | | | | | | with optimistic locking enabled. Issue #5332.
* | Removed flag attributes.Robin Roestenburg2012-03-061-1/+1
|/
* Remove unusused variablesJon Leighton2012-03-041-2/+1
|
* Improve readonly examples and optimistic locking docsCarlos Antonio da Silva2012-01-311-4/+6
| | | | | | | | | * Relation#order can receive order attributes as different arguments, add example; * Readonly does not handle deletion of records, only modification; * locking_version column does not need to default to 0, Rails handles nil values; * Change references from "set_locking_column" to "self.locking_column".
* Add ActiveRecord::Base#with_lockOlek Janiszewski2012-01-181-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a `with_lock` method to ActiveRecord objects, which starts a transaction, locks the object (pessimistically) and yields to the block. The method takes one (optional) parameter and passes it to `lock!`. Before: class Order < ActiveRecord::Base def cancel! transaction do lock! # ... cancelling logic end end end After: class Order < ActiveRecord::Base def cancel! with_lock do # ... cancelling logic end end end
* Support configuration on ActiveRecord::Model.Jon Leighton2011-12-281-1/+4
| | | | | | | | | | | | | | | The problem: We need to be able to specify configuration in a way that can be inherited to models that include ActiveRecord::Model. So it is no longer sufficient to put 'top level' config on ActiveRecord::Base, but we do want configuration specified on ActiveRecord::Base and descendants to continue to work. So we need something like class_attribute that can be defined on a module but that is inherited when ActiveRecord::Model is included. The solution: added ActiveModel::Configuration module which provides a config_attribute macro. It's a bit specific hence I am not putting this in Active Support or making it a 'public API' at present.
* Deal with global config better between AR::Base and AR::ModelJon Leighton2011-12-241-4/+1
|
* Make read_attribute code path accessible at the class levelJon Leighton2011-12-221-15/+12
|
* remove deprecated set and original methods for table_name, primary_key, etcSergey Nartimov2011-12-211-9/+1
|
* Avoid super; speeds up Model.new by about 12%Jon Leighton2011-12-141-1/+1
|
* Deprecate set_locking_column in favour of self.locking_column=Jon Leighton2011-11-291-8/+13
|
* Added a note that optimistic locking also needs a hidden field to function ↵Joost Baaij2011-10-251-0/+3
| | | | across web workers.
* Consider attempted action in exception message of ActiveRecord::StaleObjectErrorChristian Bäuerlein2011-10-141-2/+2
|
* Includes stale record in StaleObjectErrorChristian Bäuerlein2011-10-141-2/+2
|
* Make it the responsibility of the connection to hold onto an ARel visitor ↵Jon Leighton2011-08-081-2/+2
| | | | 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.
* lock_optimistically is typically true, so evaluate the common failure case firstAaron Patterson2011-06-281-1/+1
|
* Closes GH #1032John Paul Ashenfelter2011-05-191-1/+1
| | | | Fixed what looks like minor cut/paste error in documentation for ActiveRecord::Locking:Pessimistic
* Better doc styling in ActiveRecord::LockingSebastian Martinez2011-05-172-17/+17
|
* Don't quote ID's as Arel will quote them -- follow same conventions as the ↵Christopher Meiklejohn2011-05-081-1/+1
| | | | delete method.
* remove some blanksPaco Guzman2011-03-112-4/+4
|
* fixed broken link to postgresql docsSergii Boiko2011-02-151-1/+1
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>