diff --git a/fmrest-spyke.gemspec b/fmrest-spyke.gemspec index 8c0606b..388c210 100644 --- a/fmrest-spyke.gemspec +++ b/fmrest-spyke.gemspec @@ -22,6 +22,7 @@ Gem::Specification.new do |spec| spec.add_dependency "fmrest-core", "=#{FmRest::VERSION}" spec.add_dependency "spyke", ">= 7.0" + spec.add_dependency "activesupport", ">= 5.2" # NOTE: Add development deps to fmrest.gemspec end diff --git a/lib/fmrest/spyke/model/associations.rb b/lib/fmrest/spyke/model/associations.rb index d84e9a8..b65955c 100644 --- a/lib/fmrest/spyke/model/associations.rb +++ b/lib/fmrest/spyke/model/associations.rb @@ -16,12 +16,8 @@ module Associations # to parse the portalData JSON in SpykeFormatter # # TODO: Replace this with options in PortalBuilder - class_attribute :portal_options, instance_accessor: false, instance_predicate: false - - # class_attribute supports a :default option since ActiveSupport 5.2, - # but we want to support previous versions too so we set the default - # manually instead - self.portal_options = {}.freeze + class_attribute :portal_options, instance_accessor: false, instance_predicate: false, + default: {}.freeze class << self; private :portal_options=; end diff --git a/lib/fmrest/spyke/model/attributes.rb b/lib/fmrest/spyke/model/attributes.rb index 35822be..5c25220 100644 --- a/lib/fmrest/spyke/model/attributes.rb +++ b/lib/fmrest/spyke/model/attributes.rb @@ -32,12 +32,8 @@ module Attributes # Keep track of attribute mappings so we can get the FM field names # for changed attributes - class_attribute :mapped_attributes, instance_writer: false, instance_predicate: false - - # class_attribute supports a :default option since ActiveSupport 5.2, - # but we want to support previous versions too so we set the default - # manually instead - self.mapped_attributes = ::ActiveSupport::HashWithIndifferentAccess.new.freeze + class_attribute :mapped_attributes, instance_writer: false, instance_predicate: false, + default: ::ActiveSupport::HashWithIndifferentAccess.new.freeze class << self; private :mapped_attributes=; end