Class: Daddy::Model
- Inherits:
 - 
      Hash
      
        
- Object
 - Hash
 - Daddy::Model
 
 
- Extended by:
 - ActiveModel::Naming
 
- Includes:
 - ActiveModel::Conversion, ActiveModel::Validations
 
- Defined in:
 - lib/daddy/model.rb
 
Instance Method Summary collapse
- 
  
    
      #initialize(params = {})  ⇒ Model 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Model.
 - #method_missing(method, *params) ⇒ Object
 - #persisted? ⇒ Boolean
 
Constructor Details
#initialize(params = {}) ⇒ Model
Returns a new instance of Model.
      7 8 9  | 
    
      # File 'lib/daddy/model.rb', line 7 def initialize(params = {}) self.merge!(params.stringify_keys) if params end  | 
  
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *params) ⇒ Object
      15 16 17 18 19 20 21 22  | 
    
      # File 'lib/daddy/model.rb', line 15 def method_missing(method, *params) method_name = method.to_s if method_name.last == '=' self[method_name[0..-2]] = params.first else self[method_name] end end  | 
  
Instance Method Details
#persisted? ⇒ Boolean
      11 12 13  | 
    
      # File 'lib/daddy/model.rb', line 11 def persisted? false end  |