aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/customer.rb
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Removing composed_of from ActiveRecord."Rafael Mendonça França2012-07-271-0/+7
| | | | | | | | | | | 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-7/+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
* Refactor aggregation writer methodCarlos Antonio da Silva2012-05-211-1/+0
| | | | Only constantize class_name once.
* allow the :converter Proc form composed_of to return nilYves Senn2012-05-031-0/+5
| | | | | | | 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.
* send() will raise an ArgumentError, so we should leverage rubyAaron Patterson2011-01-071-1/+1
|
* Added :constructor and :converter options to composed_of and deprecated the ↵Rob Anderton2008-09-101-1/+19
| | | | | | conversion block Signed-off-by: Michael Koziarski <michael@koziarski.com>
* move assets and modelsJeremy Kemper2008-01-181-0/+55
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8657 5ecf4fe2-1ee6-0310-87b1-e25e094e27de