aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/persistence.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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' Conflicts: activerecord/test/cases/inheritance_test.rb
* Do not use update_column where update_attribute is not interchangeableRafael Mendonça França2012-08-151-6/+3
| | | | | | | | | | | | Revert "Deprecate update_attribute." This reverts commit b081f6b59fb3f15d12043072ad9b331ffd2bc56e. Reason: Since the new deprecation policy we removed the deprecation of update_attribute but we didn't reverted the changes to use update_column. Fixes #7306
* removes the deprecation of update_attributeXavier Noria2012-08-011-1/+0
| | | | Applying the new policy here to not deprecate stuff in point releases.
* revises the deprecation warning of update_attributeXavier Noria2012-08-011-1/+1
| | | | | | | We have decided not to drop this important method in 4.0 and give it a longer deprecation cycle. On the other hand we do not expect to have update_column around for a long time, it is going to be replaced in favor of update_columns.
* Revert "Add update_columns and the suggestion of using update_columnsRafael Mendonça França2012-07-301-18/+1
| | | | | | | | | | | | | | | | instead of update_column" This reverts commit 9fa06c3d9811113259cb6e00a3a8454b3974add7. This reverts commit 17a64de4980683da3ca3c185205013a29a8cf88d. This reverts commit def9c85ffbdcf63e6c412b6bd4abafaa32ccdb5c, reversing changes made to 6b7d26cf3c061907aedc44f7f36776c9b36950fd. Reason: This was supposed to be released with 3.2.7 before the suggestion to use update_column. Since it was not release now is not good to suggest to use another method because it will confusing the people.
* Suggest using update_columns instead of update_column.Philip Arndt2012-07-261-1/+1
| | | | | | update_column is deprecated in Rails 4.0 so it makes no sense to recommend adopting it only to require changing to update_columns in the very next release.
* New #update_columns method.Sebastian Martinez2012-07-261-0/+17
|
* Deprecate update_attribute.Steve Klabnik2012-06-141-3/+7
| | | | | | | | | | | 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 deprecated in favor of update_column, and will be removed in Rails 4. See the discussion on rails-core here: https://groups.google.com/d/topic/rubyonrails-core/BWPUTK7WvYA/discussion
* Make read_attribute code path accessible at the class levelJon Leighton2011-12-221-8/+0
|
* Split out most of the AR::Base code into separate modules :cake:Jon Leighton2011-12-151-0/+47
|
* `ActiveRecord::Base#becomes` should retain the errors of the original object.James Adam2011-11-161-0/+1
| | | | This commit contains a simple failing test that demonstrates the behaviour we expect, and a fix. When using `becomes` to transform the type of an object, it should retain any error information that was present on the original instance.
* Revert "Raise error on unknown primary key."Jon Leighton2011-10-051-1/+1
| | | | This reverts commit ee2be435b1e5c0e94a4ee93a1a310e0471a77d07.
* Raise error on unknown primary key.Jon Leighton2011-10-051-1/+1
| | | | | If we don't have a primary key when we ask for it, it's better to fail fast. Fixes GH #2307.
* Raise error when using write_attribute with a non-existent attribute.Jon Leighton2011-09-131-1/+1
| | | | | | | | | Previously we would just silently write the attribute. This can lead to subtle bugs (for example, see the change in AutosaveAssociation where a through association would wrongly gain an attribute. Also, ensuring that we never gain any new attributes after initialization will allow me to reduce our dependence on method_missing.
* Make it the responsibility of the connection to hold onto an ARel visitor ↵Jon Leighton2011-08-081-1/+1
| | | | 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.
* Fixed TypoJohn2011-07-241-1/+1
|
* Destroy association habtm record before destroying the record itself. Fixes ↵Tomas D'Stefano2011-07-081-0/+7
| | | | issue #402.
* cache column defaults for AR object instantiationAaron Patterson2011-06-271-3/+1
|
* Do not use default_scope in ActiveRecord::Persistence#touch.Dmitriy Kiriyenko2011-06-071-1/+1
|
* Merge branch 'master' of git://github.com/lifo/docrailsXavier Noria2011-05-251-0/+2
|\ | | | | | | | | | | Conflicts: actionmailer/lib/action_mailer/base.rb activesupport/lib/active_support/core_ext/kernel/requires.rb
| * Add more doc to #update_column.Sebastian Martinez2011-05-201-0/+2
| |
* | rescue record invalid exceptions and return false from the save method. ↵Aaron Patterson2011-05-241-1/+5
|/ | | | fixes #796
* renamed mass-assignment scopes to roles, updated code, tests, docs and ↵Josh Kalderimis2011-05-081-1/+1
| | | | security guide
* postgresql supports prepare statement deletesAaron Patterson2011-04-291-1/+9
|
* Fix #update_attributes api format errorSebastian Martinez2011-04-261-1/+1
|
* AR update_attributes api is updated to reflect the addition of assign_attributesJosh Kalderimis2011-04-261-4/+9
|
* Added new #update_column method.Sebastian Martinez2011-03-271-0/+14
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Revert "Removed #update_attribute method. New #update_column method."Sebastian Martinez2011-03-271-8/+10
| | | | | | This reverts commit 45c233ef819dc7b67e259dd73f24721fec28b8c8. Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Removed #update_attribute method. New #update_column method.Sebastian Martinez2011-03-261-10/+8
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* pushing id insertion and prefetch primary keys down to Relation#insertAaron Patterson2011-03-221-9/+1
|
* Merge remote branch 'rails/master' into identity_mapEmilio Tagua2011-02-151-3/+6
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/examples/performance.rb activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/association_proxy.rb activerecord/lib/active_record/autosave_association.rb activerecord/lib/active_record/base.rb activerecord/lib/active_record/nested_attributes.rb activerecord/test/cases/relations_test.rb
| * removed some duplication from LH issue 5505 regarding AR touch and ↵Josh Kalderimis2011-02-091-5/+1
| | | | | | | | | | | | optimistic locking [#5505 state:resolved] Signed-off-by: Santiago Pastorino and José Ignacio Costa <santiago+jose@wyeworks.com>
| * The optimistic lock column should be increased when calling touchFranck Verrot2011-02-091-0/+7
| | | | | | | | Signed-off-by: Santiago Pastorino and José Ignacio Costa <santiago+jose@wyeworks.com>
| * Do not use primary key on insertion when it's nilSantiago Pastorino2010-12-291-2/+2
| |
| * Allow primary_key to be an attribute when the model is a new recordSantiago Pastorino2010-12-281-1/+1
| |
* | Merge remote branch 'rails/master' into identity_mapEmilio Tagua2010-12-201-6/+8
|\| | | | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations/association_proxy.rb activerecord/lib/active_record/autosave_association.rb activerecord/lib/active_record/base.rb activerecord/lib/active_record/persistence.rb
| * removing calls to deprecated methodsAaron Patterson2010-12-021-1/+2
| |
| * refactor `self.class` to a variableAaron Patterson2010-12-021-1/+2
| |
| * Partialy revert f1c13b0dd7b22b5f6289ca1a09f1d7a8c7c8584bJosé Valim2010-11-281-5/+5
| |
* | Use identity mapper only if enabled.Emilio Tagua2010-11-191-3/+3
| |
* | IdentityMap - adding and removing of records on create/updateMarcin Raczkowski2010-11-191-2/+12
|/
* STI type is now updated when calling AR::Base.becomes on subclasses [#5953 ↵Franck Verrot2010-11-121-0/+1
| | | | state:resolved]
* Double negation of an already boolean value produces the same resultSantiago Pastorino2010-11-091-1/+1
|
* Don't check if persisted is defined just initialize it properlySantiago Pastorino2010-11-091-2/+0
|
* use persisted? instead of new_record? wherever possibleDavid Chelimsky2010-11-091-5/+7
| | | | | | | | | | | - 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>
* restore behavior of touch for models without :updated_xx [#5439 state:resolved]tnp2010-09-241-3/+2
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Use map instead inject.Emilio Tagua2010-09-221-4/+3
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* The call-seq directive has no useful effect on our documentation and is not ↵Joost Baaij2010-08-281-3/+0
| | | | | | | | | | | used anywhere else. Worse still, its use breaks some rdoc, replacing method names with a curly brace. Having just one call-seq directive doesn't add anything since this is covered by regular rdoc. Having multiple might make sense, but these are already documented with examples. This partly re-reverts 60de0e56b7f57f0052d7e4f43bd2ef9e363c6a1a but does not touch the vendorized code in html-scanner.
* edit pass to a recent doc patchXavier Noria2010-08-251-3/+10
|
* Merge remote branch 'docrails/master'Xavier Noria2010-08-251-2/+6
|\