aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/aggregations_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Ensure hashes can be passed to attributes using `composed_of`Sean Griffin2016-05-311-0/+5
| | | | | | | | | | | This behavior was broken by 36e9be85. When the value is assigned directly, either through mass assignment or directly assigning a hash, the hash gets passed through to this writer method directly. While this is intended to handle certain cases, when an explicit converter has been provided, we should continue to use that instead. The positioning of the added guard caused the new behavior to override that case. Fixes #25210
* Removed unnecessary classAnupam Choudhury2013-04-061-1/+0
|
* remove meaningless AS::FrozenObjectErrorAkira Matsuda2013-01-021-2/+1
|
* fix order dependent test in AggregationsTestFrancesco Rodriguez2012-08-261-0/+2
| | | | | | | | | | | | | | Ensure class variable is set to nil. It prevents the following test to fail: def test_do_not_run_the_converter_when_nil_was_set customers(:david).non_blank_gps_location = nil assert_nil Customer.gps_conversion_was_run end Check https://github.com/rails/rails/blob/master/activerecord/test/models/customer.rb#L7 for more information.
* Revert "Removing composed_of from ActiveRecord."Rafael Mendonça França2012-07-271-0/+158
| | | | | | | | | | | 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
* Removing composed_of from ActiveRecord.Steve Klabnik2012-06-181-158/+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
* allow the :converter Proc form composed_of to return nilYves Senn2012-05-031-0/+18
| | | | | | | This makes it possible to filter invalid input values before they are passed into the value-object (like empty strings). This behaviour is only relevant if the :allow_nil options is set to true. Otherwise you will get the resulting NoMethodError.
* code gardening: we have assert_(nil|blank|present), more concise, with ↵Xavier Noria2010-08-171-1/+1
| | | | better default failure messages - let's use them
* removing extra whitespacesNeeraj Singh2010-07-181-1/+1
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Remove deprecated block usage in composed_of.Emilio Tagua2010-06-241-28/+0
|
* Use better assertion methods for testingNeeraj Singh2010-05-191-10/+10
| | | | | | [#4645 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Cherry-pick core extensionsJeremy Kemper2009-05-131-0/+1
|
* Add missing assert_deprecated calls to prevent spam during test runsMichael Koziarski2008-09-111-2/+6
|
* Added :constructor and :converter options to composed_of and deprecated the ↵Rob Anderton2008-09-101-0/+35
| | | | | | conversion block Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Merge branch 'ar-test-cleanup' of git://git.geeksomnia.com/railsJeremy Kemper2008-01-211-3/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Move tests to casesJeremy Kemper2008-01-181-0/+128
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8660 5ecf4fe2-1ee6-0310-87b1-e25e094e27de