lib/blinksale/rest_client.rb
def has_many(resource_name, options = {}, block = nil)
      meta_def resource_name do |*params|
        path = (path_with_slash  + (options[:path] || resource_name.to_s))
        filter = params.first || {}
        collection = @client.resource(:path => path, :parent => self, :block => block, :filter => filter, :extend => options[:extend])
        collection.extend(CollectionMethods) # unless?
        collection.extend(options[:extend]::CollectionMethods) if options[:extend] # unless?
        collection
      end
    end
# Adds a new method to the singleton class that will return a collection resource
Adds a new method to the singleton class that will return a collection resource
Adds a new method to the singleton class that will return a collection resource
def has_many(resource_name, options = {}, block = nil)
      meta_def resource_name do |*params|
        path = (path_with_slash  + (options[:path] || resource_name.to_s))
        filter = params.first || {}
        collection = @client.resource(:path => path, :parent => self, :block => block, :filter => filter, :extend => options[:extend])
        collection.extend(CollectionMethods) 
        collection.extend(options[:extend]::CollectionMethods) if options[:extend] 
        collection
      end
    end
def has_many ( resource_name , options = { } , block = nil ) meta_def resource_name do | * params | path = ( path_with_slash + ( options [ :path ] || resource_name . to_s ) ) filter = params . first || { } collection = @client . resource ( :path => path , :parent => self , :block => block , :filter => filter , :extend => options [ :extend ] ) collection . extend ( CollectionMethods ) collection . extend ( options [ :extend ] :: CollectionMethods ) if options [ :extend ] collection end end
Adds a new method to the singleton class that will return a collection resource
Adds a new method to the singleton class that will return a collection resource
# unless? # unless?
resource_name
options
block