Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #63 from ananthakumaran/dirty_track_fix

make dirty tracking work with activemodel 3.0 & 3.1
  • Loading branch information...
commit 3b19e45ef9b904d9e633ecb54fca4ef74f792093 2 parents 626ddf7 + 26fb4fe
Josh Symonds Veraticus authored
1  lib/dynamoid/components.rb
View
@@ -18,7 +18,6 @@ module Components
include ActiveModel::AttributeMethods
include ActiveModel::Conversion
- include ActiveModel::Dirty
include ActiveModel::MassAssignmentSecurity
include ActiveModel::Naming
include ActiveModel::Observing
7 lib/dynamoid/dirty.rb
View
@@ -1,6 +1,7 @@
module Dynamoid
module Dirty
extend ActiveSupport::Concern
+ include ActiveModel::Dirty
module ClassMethods
def from_database(*)
@@ -30,5 +31,11 @@ def write_attribute(name, value)
attribute_will_change!(name) unless self.read_attribute(name) == value
super
end
+
+ protected
+
+ def attribute_method?(attr)
+ super || self.class.attributes.has_key?(attr.to_sym)
+ end
end
end
2  lib/dynamoid/fields.rb
View
@@ -33,8 +33,6 @@ def field(name, type = :string, options = {})
define_method(named) { read_attribute(named) }
define_method("#{named}?") { !read_attribute(named).nil? }
define_method("#{named}=") {|value| write_attribute(named, value) }
-
- respond_to?(:define_attribute_method) ? define_attribute_method(name) : define_attribute_methods([name])
end
def range(name, type = :string)
Please sign in to comment.
Something went wrong with that request. Please try again.