Class: Userbin::Model

Inherits:
Object
  • Object
show all
Includes:
Her::Model
Defined in:
lib/userbin/models/model.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Model

Returns a new instance of Model.



8
9
10
11
12
# File 'lib/userbin/models/model.rb', line 8

def initialize(args = {})
  # allow initializing with id as a string
  args = { id: args } if args.is_a? String
  super(args)
end

Class Method Details

.instance_custom(method, action) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/userbin/models/model.rb', line 22

def self.instance_custom(method, action)
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
    def #{action}(params={})
      self.class.#{method}("\#{request_path}/#{action}", params)
    end
  RUBY
end