aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix handling of dirty time zone aware attributesLilibeth De La Cruz2013-02-171-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 (cherry picked from commit bc982cbcb34129ea2cfe8aa1f8e0b40e444e68db) Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb Backport of #9073 Fixes #8898
* Revert "Merge pull request #6986 from kennyj/fix_6975"Andrew White2013-01-221-14/+5
| | | | | | | | | This reverts commit 8905c1fb496641c3cdb7b3b816ae6d3d4b2c2b73. Closes #8460 Conflicts: activerecord/test/cases/dirty_test.rb
* Merge pull request #8311 from alisdair/dirty-nullable-datetimeCarlos Antonio da Silva2012-11-251-0/+1
| | | | | | | | | | | Don't call will_change! for datetime nil->"". Setting a nil datetime attribute to a blank string should not cause the attribute to be dirty. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
* Merge pull request #6986 from kennyj/fix_6975Rafael Mendonça França2012-08-211-5/+14
| | | | | | | Fix #6975. Round usec when writing timestamp attribute. Conflicts: activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
* Fix #6591. If a field with timezone isn't changed, we don't call will_change!.kennyj2012-06-041-1/+2
|
* force datetime attributes to be changedSergey Nartimov2012-03-271-0/+1
| | | | backport ddb5d2f756d9d2655a07791a3b62832efd588474 to 3-2-stable
* Fix #3837.Jon Leighton2011-12-031-11/+5
| | | | | We also need to time zone convert time zone aware attributes when accessed via read_attribute, not only when via direct access.
* Remove some unnecessary code etcJon Leighton2011-12-011-19/+3
|
* Remove the need for type_cast_attribute.Jon Leighton2011-12-011-3/+16
| | | | This is good because it reduces duplication.
* Don't rely on underscore-prefixed attribute methods.Jon Leighton2011-12-011-11/+15
| | | | | | Define singleton methods on the attributes module instead. This reduces method pollution on the actual model classes. It also seems to make something faster, I am unsure why! O_o
* Remove `#among?` from Active SupportPrem Sichanugrist2011-04-131-1/+1
| | | | | | After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now. It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`.
* Change Object#either? to Object#among? -- thanks to @jamesarosen for the ↵David Heinemeier Hansson2011-04-121-1/+1
| | | | suggestion!
* Using Object#in? and Object#either? in various placesPrem Sichanugrist2011-04-111-1/+2
| | | | There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?.
* Fix before_type_cast for timezone aware attributes by caching converted ↵Adam Meehan2011-03-231-4/+5
| | | | value on write. Also remove read method reload arg on timezone attributes.
* avoid nil.dupAkira Matsuda2011-02-071-1/+1
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Make before_type_cast available for datetime fieldsAkira Matsuda2011-02-011-2/+3
| | | | | | [#3973 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* class inheritable attributes is used no more! all internal use of class ↵Josh Kalderimis2010-11-201-2/+4
| | | | | | inheritable has been changed to class_attribute. class inheritable attributes has been deprecated. Signed-off-by: José Valim <jose.valim@gmail.com>
* Cheaper attribute reads and respond_to?. Add underscore-prefixed method ↵Jeremy Kemper2010-09-091-2/+3
| | | | aliased to the attribute name so it can be overridden but still called internally.
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-1/+1
| | | | 's/[ \t]*$//' -i {} \;)
* ensuring that description does not exceed 100 columnsNeeraj Singh2010-08-021-1/+2
|
* fix stack trace lines on class_evalSantiago Pastorino2010-04-091-4/+4
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Revert "Refactoring attributes/types" [#3348 state:open]Pratik Naik2010-01-221-10/+38
| | | | | | | | | | | | | | | | | This reverts commit f936a1f100e75082081e782e5cceb272885c2df7. Conflicts: activerecord/lib/active_record.rb activerecord/lib/active_record/base.rb Revert "Fixed: #without_typecast should only disable typecasting on the duplicated attributes" [#3387 state:open] This reverts commit 2831996483c6a045f1f38d8030256eb58d9771c3. Reason : It's not generating attribute methods properly, making object.column 5x slower.
* Refactoring attributes/types [#3348 state:resolved]Eric Chapweske2009-10-171-38/+10
| | | | Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Extract generic attribute method generation to AMoJoshua Peek2009-08-041-2/+2
|
* Modified ActiveRecord::AttributeMethods to allow classes to specify ↵Paul Gillard2009-08-041-2/+2
| | | | | | attribute method prefixes and/or suffixes. Previously only suffixes were allowed. Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Track generated attribute methods in a separate moduleJoshua Peek2009-08-021-2/+2
|
* Don't need to pass attr_name to evaluate_attribute_method anymoreJoshua Peek2009-07-301-2/+2
|
* Concernify AR AttributeMethodsJoshua Peek2009-07-301-0/+60