aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* remove private attribute readerAaron Patterson2013-07-021-6/+2
|
* define attribute methods in a thread safe mannerAaron Patterson2013-07-021-5/+4
|
* we don't need to use active support *everwhere* common.Aaron Patterson2013-07-021-1/+1
|
* initialize ivars so we don't have to constantly check themAaron Patterson2013-07-021-1/+3
|
* eagerly initialize the attributes module to avoid check-then-set race conditionsAaron Patterson2013-07-021-1/+12
|
* fixes a test, and explains why AR::AttributeMethods checks ↵Xavier Noria2013-04-281-0/+3
| | | | defined?(@attributes) in some places
* ActiveRecord -> Active RecordXavier Noria2013-04-251-1/+1
|
* fixes warning in the AR test suiteXavier Noria2013-04-251-1/+1
|
* if singletons belong to the contract, test themXavier Noria2013-04-201-1/+1
| | | | | | Object#respond_to? returns singletons and thus we inherit that contract. The implementation of the predicate is good, but the test is only checking boolean semantics, which in this case is not enough.
* fix respond_to? for non selected columnNeeraj Singh2013-04-191-1/+13
| | | | | | | | | | | | | | | | | | | | | | | fixes #4208 If a query selects only a few columns and gives custom names to those columns then respond_to? was returning true for the non selected columns. However calling those non selected columns raises exception. post = Post.select("'title' as post_title").first In the above case when `post.body` is invoked then an exception is raised since `body` attribute is not selected. Howevere `respond_to?` did not behave correctly. pos.respond_to?(:body) #=> true Reason was that Active Record calls `super` to pass the call to Active Model and all the columns are defined on Active Model. Fix is to actually check if the data returned from the db contains the data for column in question.
* Fixed typos in activerecordPrathamesh Sonpatki2013-03-271-1/+1
|
* When we pass id to update_attributes it will try to set new id for that recordDmitry Vorotilin2013-03-221-1/+1
|
* fix typos in AR. lots of them.Vipul A M2013-03-191-1/+1
|
* Keep the code related to serialization in Serialization module.Nikita Afanasenko2012-11-101-8/+4
| | | | We should not need any `serialized_attributes` checks outside `ActiveRecord::AttributeMethods::Serialization` module.
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-11-031-10/+15
|\ | | | | | | | | | | | | Conflicts: actionpack/lib/action_controller/metal/mime_responds.rb activerecord/lib/active_record/attribute_methods.rb guides/source/working_with_javascript_in_rails.md
| * read_attribute is public [ci skip]Francesco Rodriguez2012-10-211-1/+1
| |
| * improve AR::AttributeMethods documentation [ci skip]Francesco Rodriguez2012-10-211-6/+10
| |
| * Fix AR::AttributeMethods#[] example [ci skip]Francesco Rodriguez2012-10-211-1/+1
| |
* | AR::AttributeMethods#[] raises AM::AttributeMissingError for missing attributes.Francesco Rodriguez2012-10-281-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following behaviour: class Person < ActiveRecord::Base belongs_to :company end # Before: person = Person.select('id').first person[:name] # => nil person.name # => ActiveModel::MissingAttributeError: missing_attribute: name person[:company_id] # => nil person.company # => nil # After: person = Person.select('id').first person[:name] # => ActiveModel::MissingAttributeError: missing_attribute: name person.name # => ActiveModel::MissingAttributeError: missing_attribute: name person[:company_id] # => ActiveModel::MissingAttributeError: missing_attribute: company_id person.company # => ActiveModel::MissingAttributeError: missing_attribute: company_id Fixes #5433.
* | Remove ActiveRecord::ModelJon Leighton2012-10-261-1/+1
|/ | | | | | | | | | 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.
* update AR::AttributeMethods documentation [ci skip]Francesco Rodriguez2012-10-211-23/+124
|
* Support for partial inserts.Jon Leighton2012-09-281-5/+5
| | | | | | | | | | | 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).
* load active_support/deprecation in active_support/railsXavier Noria2012-08-021-1/+0
|
* no need to define methods in included hookJon Leighton2012-06-151-13/+13
|
* Use each_with_object instead of each hereSantiago Pastorino2012-06-091-3/+3
|
* Merge pull request #6687 from tiegz/3-2-optimizationsJosé Valim2012-06-091-1/+3
| | | | ActiveRecord#attributes optimization: minimize objects created
* much code can be deleted thanks to @tenderlove's refactoringJon Leighton2012-03-281-8/+0
|
* Merge pull request #5294 from robinroestenburg/masterAaron Patterson2012-03-121-23/+50
|\ | | | | Refactoring of `arel_attributes_values` method
| * Removed flag attributes.Robin Roestenburg2012-03-061-19/+32
| |
| * Refactored method arel_attributes_values.Robin Roestenburg2012-03-061-20/+34
| |
* | attribute_present? should return false for empty stringsJacob Green2012-03-061-1/+1
|/
* handle id attribute in PrimaryKey moduleSergey Nartimov2012-02-111-1/+1
|
* adding a comment for myselfAaron Patterson2012-02-061-0/+1
|
* Fix another race condition.Jon Leighton2012-01-201-3/+0
| | | | | | From 2c667f69aa2daac5ee6c29ca9679616e2a71532a. Thanks @pwnall for the heads-up.
* Fix race condition :bomb:Jon Leighton2012-01-131-4/+11
|
* Revert "Base#[] and Base#[]= are aliases so implement them as aliases :)"Tom Stuart2012-01-111-4/+6
| | | | This reverts commit 21eadc1b3f2eb818a4833381ee0a6cfa205f2955.
* Support establishing connection on ActiveRecord::Model.Jon Leighton2011-12-281-1/+1
| | | | | This is the 'top level' connection, inherited by any models that include ActiveRecord::Model or inherit from ActiveRecord::Base.
* Ensure attribute methods are included after all the AR stuffJon Leighton2011-12-241-1/+1
|
* Extract common logic into a methodJon Leighton2011-12-241-1/+1
|
* Fix situation where id method didn't get defined causing postgres to failJon Leighton2011-12-231-4/+3
|
* Fix #4046.Jon Leighton2011-12-231-42/+33
|
* remove deprecated underscore versions of attribute methodsSergey Nartimov2011-12-211-1/+0
|
* Let AttributeMethods do its own including etcJon Leighton2011-12-151-0/+23
|
* Split out most of the AR::Base code into separate modules :cake:Jon Leighton2011-12-151-2/+113
|
* Use a separate module for 'external' attribute methods.Jon Leighton2011-12-141-0/+14
|
* Remove the need for type_cast_attribute.Jon Leighton2011-12-011-0/+4
| | | | This is good because it reduces duplication.
* Remove unnecessary *argsJon Leighton2011-12-011-2/+2
|
* Stop trying to be clever about when to define attribute methods.Jon Leighton2011-09-141-10/+1
| | | | | | | | | There is no meaningful performance penalty in defining attribute methods, since it only happens once. There is also no reason *not* to define them, since they get thrown in an included module, so they will not 'overwrite' anything. In fact, this is desirable, since it allows us to call super.
* We don't need to build a set for DangerousAttributeError.Jon Leighton2011-09-141-7/+13
| | | | We can just use method_defined? and private_method_defined?
* Deprecate using method_missing for attributes that are columns.Jon Leighton2011-09-131-0/+15
| | | | | | This shouldn't ever happen unless people are doing something particularly weird, but adding a deprecation in case there are bugs not caught by our tests.