Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1175 from joshk/active_resource_correction

attr_accessor_with_default removed from ActiveResource
  • Loading branch information...
commit fa3f273173b83b604cc37016d1f2b3b17ce26b22 2 parents 5eadb4d + 1bfe9ec
@josevalim josevalim authored
Showing with 16 additions and 4 deletions.
  1. +16 −4 activeresource/lib/active_resource/base.rb
View
20 activeresource/lib/active_resource/base.rb
@@ -3,7 +3,6 @@
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 @@ def headers
@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.
Please sign in to comment.
Something went wrong with that request. Please try again.