Ticket #7638: composed_of_form_helpers_documentation.diff
| File composed_of_form_helpers_documentation.diff, 1.1 kB (added by oyam, 1 year ago) |
|---|
-
activerecord/lib/active_record/aggregations.rb
old new 108 108 # 109 109 # Read more about value objects on http://c2.com/cgi/wiki?ValueObject and on the dangers of not keeping value objects 110 110 # immutable on http://c2.com/cgi/wiki?ValueObjectsShouldBeImmutable 111 # 112 # == Using value objects with form helpers 113 # 114 # Because the form helpers use value_before_typecast for rendering values, the helpers will always render with the raw value 115 # rather than the content of value object's to_s method, as one might expect. Because of this, a correct value needs to be 116 # supplied to the helper. Example: 117 # 118 # <%= input(:product, :price, :value => @product.price.to_s) %> 111 119 module ClassMethods 112 120 # Adds reader and writer methods for manipulating a value object: 113 121 # <tt>composed_of :address</tt> adds <tt>address</tt> and <tt>address=(new_address)</tt> methods.