aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/persistence.rb
Commit message (Collapse)AuthorAgeFilesLines
...
| * Added documentation about how touch now throws an error when one trieswangjohn2013-02-251-0/+7
| | | | | | | | to use it on an unpersisted object.
* | Merge pull request #9246 from Noemj/update_prepared_statementsAaron Patterson2013-02-241-3/+12
|\ \ | |/ |/| Changed update to use prepared statements
| * Changed update_record to use prepared statements.Noemj2013-02-111-3/+12
| |
* | Raising an ActiveRecordError when one tries to use .touch(name) on a newwangjohn2013-02-251-0/+2
| | | | | | | | | | object that has not yet been persisted. This behavior follows the precedent set by update_columns.
* | Reduced memory leak problem in transactions by lazily updating AR objects ↵wangjohn2013-02-201-0/+2
| | | | | | | | with new transaction state. If AR object has a callback, the callback will be performed immediately (non-lazily) so the transaction still has to keep records with callbacks.
* | Refactor to use each_key, remove extra spacesCarlos Antonio da Silva2013-01-281-2/+2
|/
* iterates the RDoc of update_column(s)Xavier Noria2013-01-181-13/+13
| | | | | | | | This revision makes crystal clear that the methods go straight to the database and update the receiver. It also adds and example, and removes the duplication in the singular and plural forms by referring one to the other.
* Change docs to use update instead of update_attributesAmparo Luna + Guillermo Iguaran2013-01-031-1/+1
|
* Rename update_attributes method to update, keep update_attributes as an aliasAmparo Luna + Guillermo Iguaran2013-01-031-5/+9
|
* Unscope update_column(s) query to ignore default scopeCarlos Antonio da Silva2012-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | When applying default_scope to a class with a where clause, using update_column(s) could generate a query that would not properly update the record due to the where clause from the default_scope being applied to the update query. class User < ActiveRecord::Base default_scope where(active: true) end user = User.first user.active = false user.save! user.update_column(:active, true) # => false In this situation we want to skip the default_scope clause and just update the record based on the primary key. With this change: user.update_column(:active, true) # => true Fixes #8436.
* Move instantiation responsibilities from Inheritance to Persistence. Have ↵Jeremy Kemper2012-11-291-0/+26
| | | | Inheritance#discriminate_class_for_record handle STI lookup duties.
* Remove observers and sweepersRafael Mendonça França2012-11-281-1/+1
| | | | | | | | They was extracted from a plugin. See https://github.com/rails/rails-observers [Rafael Mendonça França + Steve Klabnik]
* Remove return guard and use code convetionsRafael Mendonça França2012-11-201-7/+11
|
* Remove not needed begin..end from AR#saveCarlos Antonio da Silva2012-11-191-5/+3
|
* AR::Base.becomes should not change the STI typeThomas Hollstegge2012-11-171-1/+12
| | | | If you want to change the STI type too, use AR::Base.becomes! instead
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-11-031-9/+9
|\ | | | | | | | | | | | | Conflicts: actionpack/lib/action_controller/metal/mime_responds.rb activerecord/lib/active_record/attribute_methods.rb guides/source/working_with_javascript_in_rails.md
| * Another batch of hash syntax changes to comment, this time around, I tried ↵AvnerCohen2012-10-231-9/+9
| | | | | | | | to keep 'output' messages untouched.
* | Enable update_column(s) for the primary key attribute.Henrik N2012-10-281-1/+3
|/ | | | Didn't work before because it updated the model-in-memory first, so the DB query couldn't find the record.
* copy edits [ci skip]Vijay Dev2012-10-111-2/+2
|
* Added clarity to update_column(s)Adam Haymond2012-10-101-2/+2
|
* Support for partial inserts.Jon Leighton2012-09-281-2/+2
| | | | | | | | | | | When inserting new records, only the fields which have been changed from the defaults will actually be included in the INSERT statement. The other fields will be populated by the database. This is more efficient, and also means that it will be safe to remove database columns without getting subsequent errors in running app processes (so long as the code in those processes doesn't contain any references to the removed column).
* Update AR::Base.create and AR:Base#update_attributes docs to remove ↵Guillermo Iguaran2012-09-181-11/+0
| | | | references to mass assignment options
* Remove mass_assignment_options from ActiveRecordGuillermo Iguaran2012-09-161-7/+7
|
* Remove mass assignment security from ActiveRecordGuillermo Iguaran2012-09-161-2/+2
|
* set the configured #inheritance_column on #become (#7503)Yves Senn2012-09-031-1/+1
| | | | | | | | | | | | | | | I had to create a new table because I needed an STI table, which does not have both a "type" and a "custom_type" the test fails with: 1) Error: test_alt_becomes_works_with_sti(InheritanceTest): NoMethodError: undefined method `type=' for #<Cabbage id: 1, name: "my cucumber", custom_type: "Cucumber"> /Users/username/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:432:in `method_missing' /Users/username/Projects/rails/activerecord/lib/active_record/attribute_methods.rb:100:in `method_missing' /Users/username/Projects/rails/activerecord/lib/active_record/persistence.rb:165:in `becomes' test/cases/inheritance_test.rb:134:in `test_becomes_works_with_sti' test/cases/inheritance_test.rb:140:in `test_alt_becomes_works_with_sti'
* Use verify_readonly_attribute in the update_columns methodRafael Mendonça França2012-08-251-1/+1
|
* Revert "Remove private verify readonly attr method"Rafael Mendonça França2012-08-251-1/+5
| | | | This reverts commit 7a8aee08b610f6edbfe5be076dc14e5cdcf1355e.
* Revert "Remove update_attribute."Rafael Mendonça França2012-08-251-4/+18
| | | | | | | | | | | This reverts commit a7f4b0a1231bf3c65db2ad4066da78c3da5ffb01. Conflicts: activerecord/lib/active_record/associations/has_one_association.rb activerecord/lib/active_record/persistence.rb activerecord/test/cases/base_test.rb activerecord/test/cases/dirty_test.rb activerecord/test/cases/timestamp_test.rb
* Remove private verify readonly attr methodCarlos Antonio da Silva2012-08-191-5/+1
| | | | | | | | | | This method was added to be shared between update_attribute and update_column in 50725cec397d4fa0ecf1dda4e6ae845a993f1ba7, but since update_attribute was removed, and update_column has changed to delegate to update_columns, the method is not used anywhere anymore. Also remove "key.to_s" conversion when raising readonly error, since the key is being interpolated.
* load active_support/concern in active_support/railsXavier Noria2012-08-021-1/+0
|
* Remove the deprecation of update_column.Rafael Mendonça França2012-07-301-5/+0
| | | | | | update_column was suggested as replacement of update_attribute at the last release of 3-2-stable, so deprecating it now will confuse the users.
* Revert "Removing composed_of from ActiveRecord."Rafael Mendonça França2012-07-271-0/+1
| | | | | | | | | | | This reverts commit 14fc8b34521f8354a17e50cd11fa3f809e423592. Reason: we need to discuss a better path from this removal. Conflicts: activerecord/lib/active_record/reflection.rb activerecord/test/cases/base_test.rb activerecord/test/models/developer.rb
* Deprecate update_column in favor of update_columns.Rafael Mendonça França2012-07-241-3/+8
| | | | Closes #1190
* Use update_columns to implemente the update_columnRafael Mendonça França2012-07-241-17/+18
|
* New #update_columns method.Sebastian Martinez2012-07-241-0/+17
|
* Removing composed_of from ActiveRecord.Steve Klabnik2012-06-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This feature adds a lot of complication to ActiveRecord for dubious value. Let's talk about what it does currently: class Customer < ActiveRecord::Base composed_of :balance, :class_name => "Money", :mapping => %w(balance amount) end Instead, you can do something like this: def balance @balance ||= Money.new(value, currency) end def balance=(balance) self[:value] = balance.value self[:currency] = balance.currency @balance = balance end Since that's fairly easy code to write, and doesn't need anything extra from the framework, if you use composed_of today, you'll have to add accessors/mutators like that. Closes #1436 Closes #2084 Closes #3807
* Remove update_attribute.Steve Klabnik2012-06-141-18/+3
| | | | | | | | | | | Historically, update_attribute and update_attributes are similar, but with one big difference: update_attribute does not run validations. These two methods are really easy to confuse given their similar names. Therefore, update_attribute is being removed in favor of update_column. See the thread on rails-core here: https://groups.google.com/forum/?fromgroups#!topic/rubyonrails-core/BWPUTK7WvYA
* + ActiveRecord::Base#destroy!Marc-Andre Lafortune2012-06-061-0/+16
|
* Don't destroy readonly modelsJohannes Barre2012-05-171-0/+1
|
* Removed extraneous .present? check for AR::Base#reloadJeremy Friesen2012-04-291-1/+1
|
* Removed deprecation warning for #find as a result of AR::Base#reloadJeremy Friesen2012-04-291-1/+7
| | | | | Cleaned up "DEPRECATION WARNING: Passing options to #find is deprecated. Please build a scope and then call #find on it."
* remove deprecate #update_all usageJon Leighton2012-04-261-2/+2
|
* clear up duplication between Persistence#destroy and Locking#destroyJon Leighton2012-03-301-13/+17
|
* Remove IdentityMapCarlos Antonio da Silva2012-03-131-12/+4
|
* Removed flag attributes.Robin Roestenburg2012-03-061-2/+2
|
* Refactor and cleanup in some ActiveRecord modulesCarlos Antonio da Silva2012-03-031-3/+8
| | | | | | | | | | | * Avoid double hash lookups in AR::Reflection when reflecting associations/aggregations * Minor cleanups: use elsif, do..end, if..else instead of unless..else * Simplify DynamicMatchers#respond_to? * Use "where" instead of scoped with conditions hash * Extract `scoped_by` method pattern regexp to constant * Extract noisy class_eval from method_missing in dynamic matchers * Extract readonly check, avoid calling column#to_s twice in persistence * Refactor predicate builder, remove some variables
* copy over columns hash on reloadAaron Patterson2012-02-071-0/+1
|
* Clarify what persisted? returns.Uģis Ozols2011-12-251-2/+2
|
* Remove extra 'be'.Uģis Ozols2011-12-251-1/+1
|
* removes some unnecessary selfsXavier Noria2011-12-201-3/+3
|