module Cyrax::Extensions::HasResource::ClassMethods

Public Instance Methods

accessible_attributes(*attrs) click to toggle source

Class method for setting all the attributes that you want to access in the resource

@example

accessible_attributes :description, :model, :price_in_cents, :vendor

@param attrs [Array(Symbol)] Symbols of the attributes

# File lib/cyrax/extensions/has_resource.rb, line 50
def accessible_attributes(*attrs)
  if attrs.blank?
    @accessible_attributes || []
  else
    @accessible_attributes ||= []
    @accessible_attributes += attrs
  end
end
resource(name, options = {}) click to toggle source

Class method for setting the resource that you want to access

@example

resource :product

@param name [Symbol] The name of the resource @param options Hash [Hash] Options

# File lib/cyrax/extensions/has_resource.rb, line 66
def resource(name, options = {})
  self.resource_name = name.to_s
  self.resource_class_name = options[:class_name]
  self.collection_name = name.to_s.pluralize
end