Skip to content
This repository
Browse code

attr_accessor_with_default is deprecated, so lets not use it in Activ…

…eResource
  • Loading branch information...
commit 1bfe9ec5de03003d02dd8528bae427271f459ad6 1 parent 95bd199
Josh Kalderimis authored
20  activeresource/lib/active_resource/base.rb
@@ -3,7 +3,6 @@
3 3
 require 'active_support/core_ext/class/attribute'
4 4
 require 'active_support/core_ext/hash/indifferent_access'
5 5
 require 'active_support/core_ext/kernel/reporting'
6  
-require 'active_support/core_ext/module/attr_accessor_with_default'
7 6
 require 'active_support/core_ext/module/delegation'
8 7
 require 'active_support/core_ext/module/aliasing'
9 8
 require 'active_support/core_ext/object/blank'
@@ -565,10 +564,23 @@ def headers
565 564
         @headers ||= {}
566 565
       end
567 566
 
568  
-      attr_accessor_with_default(:element_name)    { model_name.element } #:nodoc:
569  
-      attr_accessor_with_default(:collection_name) { ActiveSupport::Inflector.pluralize(element_name) } #:nodoc:
  567
+      attr_writer :element_name
570 568
 
571  
-      attr_accessor_with_default(:primary_key, 'id') #:nodoc:
  569
+      def element_name
  570
+        @element_name ||= model_name.element
  571
+      end
  572
+
  573
+      attr_writer :collection_name
  574
+
  575
+      def collection_name
  576
+        @collection_name ||= ActiveSupport::Inflector.pluralize(element_name)
  577
+      end
  578
+
  579
+      attr_writer :primary_key
  580
+
  581
+      def primary_key
  582
+        @primary_key ||= 'id'
  583
+      end
572 584
 
573 585
       # Gets the \prefix for a resource's nested URL (e.g., <tt>prefix/collectionname/1.json</tt>)
574 586
       # This method is regenerated at runtime based on what the \prefix is set to.

0 notes on commit 1bfe9ec

Please sign in to comment.
Something went wrong with that request. Please try again.