aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2013-11-071-0/+3
|\
| * warning about saving models with dirty attributesDamien Mathieu2013-10-231-0/+3
| | | | | | | | See #8328
* | `ActiveRecord::Store` works together with PG `hstore` columns.Yves Senn2013-10-251-0/+4
|/ | | | | | This is necessary because as of 5ac2341 `hstore` columns are always stored as `Hash` with `String` keys. `ActiveRecord::Store` expected the attribute to be an instance of `HashWithIndifferentAccess`, which led to the bug.
* Merge pull request #10816 from bogdan/less-dirty-dirtyRafael Mendonça França2013-09-231-9/+6
| | | | Make AM::Dirty less dirty to plugin into AR or other library
* Merge pull request #12188 from SamSaffron/masterAaron Patterson2013-09-111-7/+8
|\ | | | | Perf: avoid dupes add fallback logic for coders
| * Perf: avoid dupes add fallback logic for codersSam2013-09-111-7/+8
| |
* | Perf: avoid array allocation where not neededSam2013-08-271-1/+1
|/
* method transplanting between modules isn't supported on 1.9Aaron Patterson2013-07-032-10/+51
|
* refactor the method cache objects to have a superclassAaron Patterson2013-07-032-51/+16
|
* keep a cache of writer methodsAaron Patterson2013-07-031-11/+34
|
* move the reader method cache in to the read moduleAaron Patterson2013-07-031-1/+49
|
* keep a cache of the reader methods so we can reuse themAaron Patterson2013-07-031-34/+2
|
* reduce the amount of code Ruby has to parseAaron Patterson2013-07-021-3/+8
|
* making the comment more accurateAaron Patterson2013-07-021-2/+5
|
* stop storing multiple copies of a particular attribute nameAaron Patterson2013-07-022-4/+6
|
* eagerly assign the attribute name cache, remove const_missingAaron Patterson2013-07-022-0/+4
|
* Removed deprecated methods partial_updates and familyNeeraj Singh2013-07-021-11/+0
| | | | | Removed deprecated methods `partial_updates`, `partial_updates?` and `partial_updates=`
* fix serialization type cast when value is already unserializedJan Berdajs2013-06-051-1/+5
|
* the typecast value should be passed to the serializer. fixes #10830Aaron Patterson2013-06-051-5/+5
|
* Remove instance level serialized_attributes setting was deprecated.kennyj2013-06-021-7/+0
|
* read_attribute_before_type_cast should accept symbolNeeraj Singh2013-05-111-1/+2
|
* fix :nodoc: mark on AR::AttributeMethods::Serialization [ci skip]Francesco Rodriguez2013-04-121-2/+2
|
* update ActiveRecord::AttributeMethods::Serialization documentation [ci skip]Francesco Rodriguez2013-04-041-0/+7
|
* safely publish columns and columns hash infoAaron Patterson2013-03-141-1/+1
|
* assigning '0.0' to a nullable numeric column does not make it dirtyYves Senn2013-03-051-1/+5
|
* Reduced memory leak problem in transactions by lazily updating AR objects ↵wangjohn2013-02-201-0/+5
| | | | 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.
* Gist URLs are now namespacedAkira Matsuda2013-02-181-1/+1
| | | | see: https://github.com/blog/1406-namespaced-gists
* Simplify type casting code for timezone aware attributesAndrew White2013-01-261-10/+5
| | | | | | With the addition of String#in_time_zone and Date#in_time_zone we can simplify the type casting code by checking if the value has an `in_time_zone` method.
* Fix handling of dirty time zone aware attributesLilibeth De La Cruz2013-01-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when `time_zone_aware_attributes` were enabled, after changing a datetime or timestamp attribute and then changing it back to the original value, `changed_attributes` still tracked the attribute as changed. This caused `[attribute]_changed?` and `changed?` methods to return true incorrectly. Example: in_time_zone 'Paris' do order = Order.new original_time = Time.local(2012, 10, 10) order.shipped_at = original_time order.save order.changed? # => false # changing value order.shipped_at = Time.local(2013, 1, 1) order.changed? # => true # reverting to original value order.shipped_at = original_time order.changed? # => false, used to return true end
* Revert "Round usec when writing timestamp attribute."Andrew White2013-01-221-13/+5
| | | | | | | | | | This reverts commit e9d2ad395ec2ef929d74752f3d71c80674044fbe. Closes #8460 Conflicts: activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb activerecord/test/cases/dirty_test.rb
* change unless !blank? to if blank? in get_primary_keyAngelo capilleri2013-01-081-1/+1
|
* These are already required through AS/railsAkira Matsuda2013-01-071-1/+0
| | | | | | * dependencies/autoload * concern * deprecation
* Rename update_attributes method to update, keep update_attributes as an aliasAmparo Luna + Guillermo Iguaran2013-01-031-2/+2
|
* Serialized attribute can be serialized in an integer columnRafael Mendonça França2012-12-211-0/+8
| | | | Fix #8575
* Don't call will_change! for datetime nil->"".Alisdair McDiarmid2012-11-251-0/+1
| | | | | | | Setting a nil datetime attribute to a blank string should not cause the attribute to be dirty. Fix #8310
* Don't allocate new strings in compiled attribute methodsJon Leighton2012-11-212-20/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This improves memory and performance without having to use symbols which present DoS problems. Thanks @headius and @tenderlove for the suggestion. This was originally committed in f1765019ce9b6292f2264b4601dad5daaffe3a89, and then reverted in d3494903719682abc0948bef290af0d3d7b5a440 due to it causing problems in a real application. This second attempt should solve that. Benchmark --------- require 'active_record' require 'benchmark/ips' ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') class Post < ActiveRecord::Base connection.create_table :posts, force: true do |t| t.string :name end end post = Post.create name: 'omg' Benchmark.ips do |r| r.report('Post.new') { Post.new name: 'omg' } r.report('post.name') { post.name } r.report('post.name=') { post.name = 'omg' } r.report('Post.find(1).name') { Post.find(1).name } end Before ------ Calculating ------------------------------------- Post.new 1419 i/100ms post.name 7538 i/100ms post.name= 3024 i/100ms Post.find(1).name 243 i/100ms ------------------------------------------------- Post.new 20637.6 (±12.7%) i/s - 102168 in 5.039578s post.name 1167897.7 (±18.2%) i/s - 5186144 in 4.983077s post.name= 64305.6 (±9.6%) i/s - 317520 in 4.998720s Post.find(1).name 2678.8 (±10.8%) i/s - 13365 in 5.051265s After ----- Calculating ------------------------------------- Post.new 1431 i/100ms post.name 7790 i/100ms post.name= 3181 i/100ms Post.find(1).name 245 i/100ms ------------------------------------------------- Post.new 21308.8 (±12.2%) i/s - 105894 in 5.053879s post.name 1534103.8 (±2.1%) i/s - 7634200 in 4.979405s post.name= 67441.0 (±7.5%) i/s - 337186 in 5.037871s Post.find(1).name 2681.9 (±10.6%) i/s - 13475 in 5.084511s
* Remove return guardCarlos Antonio da Silva2012-11-171-2/+1
|
* Keep the code related to serialization in Serialization module.Nikita Afanasenko2012-11-101-1/+9
| | | | We should not need any `serialized_attributes` checks outside `ActiveRecord::AttributeMethods::Serialization` module.
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-11-031-0/+43
|\ | | | | | | | | | | | | Conflicts: actionpack/lib/action_controller/metal/mime_responds.rb activerecord/lib/active_record/attribute_methods.rb guides/source/working_with_javascript_in_rails.md
| * Fix code example in AR::AttributeMethods::BeforeTypeCast.Hendy Tanata2012-10-221-1/+1
| |
| * add docs to AR::AttributeMethods::BeforeTypeCast [ci skip]Francesco Rodriguez2012-10-211-0/+23
| |
| * fix typo and improve example [ci skip]Francesco Rodriguez2012-10-211-1/+3
| |
| * update AR::AttributeMethods::BeforeTypeCast docs [ci skip]Francesco Rodriguez2012-10-211-0/+18
| |
* | Revert "Don't allocate new strings in compiled attribute methods"David Heinemeier Hansson2012-10-312-39/+20
| | | | | | | | This reverts commit f1765019ce9b6292f2264b4601dad5daaffe3a89.
* | Fix `attributes_before_type_cast` for serialised attributes.Nikita Afanasenko2012-10-311-0/+10
| | | | | | | | Public method `attributes_before_type_cast` used to return internal AR structure (ActiveRecord::AttributeMethods::Serialization::Attribute), patch fixes this. Now behaves like `read_attribute_before_type_cast` and returns unserialised values.
* | Make caller attribute in deprecation methods optionalAlexey Gaziev2012-10-301-1/+1
| |
* | Provide a call stack for deprecation warnings where needed.Nikita Afanasenko2012-10-291-1/+2
| | | | | | | | It's sometimes hard to quickly find where deprecated call was performed, especially in case of migrating between Rails versions. So this is an attempt to improve the call stack part of the warning message by providing caller explicitly.
* | Remove ActiveRecord::ModelJon Leighton2012-10-263-24/+9
|/ | | | | | | | | | 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-203-3/+3
| | | | This reverts commit 83846838252397b3781eed165ca301e05db39293.
* Get rid of the ActiveRecord::Model::DeprecationProxy thing.Jon Leighton2012-10-193-3/+3
| | | | | | | | | | | | | | | | | 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.