aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/attribute.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/lib/active_model/attribute.rb')
-rw-r--r--activemodel/lib/active_model/attribute.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/activemodel/lib/active_model/attribute.rb b/activemodel/lib/active_model/attribute.rb
index b75ff80b31..3f19cda07b 100644
--- a/activemodel/lib/active_model/attribute.rb
+++ b/activemodel/lib/active_model/attribute.rb
@@ -133,10 +133,6 @@ module ActiveModel
end
protected
-
- attr_reader :original_attribute
- alias_method :assigned?, :original_attribute
-
def original_value_for_database
if assigned?
original_attribute.original_value_for_database
@@ -146,6 +142,9 @@ module ActiveModel
end
private
+ attr_reader :original_attribute
+ alias :assigned? :original_attribute
+
def initialize_dup(other)
if defined?(@value) && @value.duplicable?
@value = @value.dup
@@ -233,6 +232,10 @@ module ActiveModel
false
end
+ def forgetting_assignment
+ dup
+ end
+
def with_type(type)
self.class.new(name, type)
end