aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/values
diff options
context:
space:
mode:
authorLisa Ugray <lisa.ugray@shopify.com>2017-10-12 14:13:45 -0400
committerLisa Ugray <lisa.ugray@shopify.com>2017-10-18 13:05:30 -0400
commit7e9ded512dd58a923a3be038843708dbba4215f6 (patch)
treecf31a52147933fb1275d4e7e7a1ae2bb59418f12 /activesupport/lib/active_support/values
parentded41a9b84299f536bc136d78069a50a2e867768 (diff)
downloadrails-7e9ded512dd58a923a3be038843708dbba4215f6.tar.gz
rails-7e9ded512dd58a923a3be038843708dbba4215f6.tar.bz2
rails-7e9ded512dd58a923a3be038843708dbba4215f6.zip
Start bringing attributes API to AM
This is the first PR of a WIP to bring the attributes API to ActiveModel. It is not yet ready for public API. The `attributes_dirty_test.rb` file was created based on `dirty_test.rb`, and the simplifications in the diff do much to motivate this change. ``` diff activemodel/test/cases/dirty_test.rb activemodel/test/cases/attributes_dirty_test.rb 3a4 > require "active_model/attributes" 5c6 < class DirtyTest < ActiveModel::TestCase --- > class AttributesDirtyTest < ActiveModel::TestCase 7,41c8,12 < include ActiveModel::Dirty < define_attribute_methods :name, :color, :size < < def initialize < @name = nil < @color = nil < @size = nil < end < < def name < @name < end < < def name=(val) < name_will_change! < @name = val < end < < def color < @color < end < < def color=(val) < color_will_change! unless val == @color < @color = val < end < < def size < @size < end < < def size=(val) < attribute_will_change!(:size) unless val == @size < @size = val < end --- > include ActiveModel::Model > include ActiveModel::Attributes > attribute :name, :string > attribute :color, :string > attribute :size, :integer ```
Diffstat (limited to 'activesupport/lib/active_support/values')
0 files changed, 0 insertions, 0 deletions