Commit Graph

5 Commits

Author SHA1 Message Date
kennyj 539b69e05d Remove instance level quote_value method. This method is private and also exists in class method. 2012-07-14 03:06:18 +09:00
Steve Klabnik 14fc8b3452 Removing composed_of from ActiveRecord.
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
2012-06-18 14:53:03 -04:00
Jon Leighton 4bd9482a1a de-globalise method 2012-05-04 12:50:07 +01:00
Carlos Antonio da Silva 50725cec39 Refactor and cleanup in some ActiveRecord modules
* Avoid double hash lookups in AR::Reflection when reflecting associations/aggregations
* Minor cleanups: use elsif, do..end, if..else instead of unless..else
* Simplify DynamicMatchers#respond_to?
* Use "where" instead of scoped with conditions hash
* Extract `scoped_by` method pattern regexp to constant
* Extract noisy class_eval from method_missing in dynamic matchers
* Extract readonly check, avoid calling column#to_s twice in persistence
* Refactor predicate builder, remove some variables
2012-03-03 04:09:50 -03:00
Jon Leighton ceb33f8493 Split out most of the AR::Base code into separate modules 🍰 2011-12-15 20:45:37 +00:00