Permalink
Browse files

Make the custom finders compatible with ActiveResource < 3

  • Loading branch information...
staugaard committed Feb 14, 2012
1 parent ae511c5 commit f48559ebe7dc4b3584694fb0292e46ea2bccfe21
@@ -5,7 +5,7 @@ def self.find_all_by_product_family_id(product_family_id)
end
def self.find_by_product_family_id_and_code(product_family_id, code)
- Coupon.new(get(:lookup, :product_family_id => product_family_id, :code => code), true)
+ find(:one, :from => :lookup, :params => {:product_family_id => product_family_id, :code => code})
end
def usage
@@ -1,7 +1,7 @@
module Chargify
class Customer < Base
def self.find_by_reference(reference)
- Customer.new(get(:lookup, :reference => reference), true)
+ find(:one, :from => :lookup, :params => {:reference => reference})
end
class Subscription < Base
@@ -1,7 +1,7 @@
module Chargify
class Product < Base
def self.find_by_handle(handle)
- Product.new(get(:lookup, :handle => handle), true)
+ find(:one, :from => :lookup, :params => {:handle => handle})
end
protected

0 comments on commit f48559e

Please sign in to comment.