Skip to content
Browse files

Only use attr_writer for primary_key, as the reader method exists

  • Loading branch information...
1 parent 4c43c5c commit 67217099d39bc25214e611cb17e229f3430a5dc7 @carlosantoniodasilva committed Mar 15, 2012
Showing with 13 additions and 13 deletions.
  1. +13 −13 lib/poundpay/resource.rb
View
26 lib/poundpay/resource.rb
@@ -7,7 +7,7 @@ class Resource < ActiveResource::Base
self.format = Formats::UrlencodedJsonFormat
class << self
- attr_accessor :primary_key
+ attr_writer :primary_key
def primary_key
@primary_key ||= 'sid'
@@ -45,9 +45,9 @@ def instantiate_collection(collection, prefix_options = {})
end
protected
- def remove_extension(path)
- path.sub /(\.#{format.extension})/, ""
- end
+ def remove_extension(path)
+ path.sub /(\.#{format.extension})/, ""
+ end
end
# Poundpay accepts urlencoded form parameters
@@ -61,14 +61,14 @@ def collection_name
end
protected
- def self.urlencode(params)
- params.to_a.collect! { |k, v|
- if v.kind_of?(Array)
- v.collect! { |x| "#{k}=#{CGI.escape(x.to_s)}"}.join("&")
- else
- "#{k}=#{CGI.escape(v.to_s)}"
- end
- }.join("&")
+ def self.urlencode(params)
+ params.to_a.collect! { |k, v|
+ if v.kind_of?(Array)
+ v.collect! { |x| "#{k}=#{CGI.escape(x.to_s)}" }.join("&")
+ else
+ "#{k}=#{CGI.escape(v.to_s)}"
end
+ }.join("&")
+ end
end
-end
+end

0 comments on commit 6721709

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