diff options
author | Josh Kalderimis <josh.kalderimis@gmail.com> | 2011-05-21 01:05:35 -0400 |
---|---|---|
committer | Josh Kalderimis <josh.kalderimis@gmail.com> | 2011-05-21 01:05:35 -0400 |
commit | 1bfe9ec5de03003d02dd8528bae427271f459ad6 (patch) | |
tree | 130695160b06c6f55c6eb9034984e2f939263d52 /activeresource | |
parent | 95bd19911a62fe7dbe8e72c08e29902efdcfce85 (diff) | |
download | rails-1bfe9ec5de03003d02dd8528bae427271f459ad6.tar.gz rails-1bfe9ec5de03003d02dd8528bae427271f459ad6.tar.bz2 rails-1bfe9ec5de03003d02dd8528bae427271f459ad6.zip |
attr_accessor_with_default is deprecated, so lets not use it in ActiveResource
Diffstat (limited to 'activeresource')
-rw-r--r-- | activeresource/lib/active_resource/base.rb | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb index 65d285249b..0c272fa093 100644 --- a/activeresource/lib/active_resource/base.rb +++ b/activeresource/lib/active_resource/base.rb @@ -3,7 +3,6 @@ require 'active_support/core_ext/class/attribute_accessors' require 'active_support/core_ext/class/attribute' require 'active_support/core_ext/hash/indifferent_access' require 'active_support/core_ext/kernel/reporting' -require 'active_support/core_ext/module/attr_accessor_with_default' require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/module/aliasing' require 'active_support/core_ext/object/blank' @@ -565,10 +564,23 @@ module ActiveResource @headers ||= {} end - attr_accessor_with_default(:element_name) { model_name.element } #:nodoc: - attr_accessor_with_default(:collection_name) { ActiveSupport::Inflector.pluralize(element_name) } #:nodoc: + attr_writer :element_name - attr_accessor_with_default(:primary_key, 'id') #:nodoc: + def element_name + @element_name ||= model_name.element + end + + attr_writer :collection_name + + def collection_name + @collection_name ||= ActiveSupport::Inflector.pluralize(element_name) + end + + attr_writer :primary_key + + def primary_key + @primary_key ||= 'id' + end # Gets the \prefix for a resource's nested URL (e.g., <tt>prefix/collectionname/1.json</tt>) # This method is regenerated at runtime based on what the \prefix is set to. |