Class: ValidateableModel
- Inherits:
-
Object
- Object
- ValidateableModel
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Conversion, ActiveModel::Validations
- Defined in:
- lib/auxiliary_addons/validateable_model.rb
Overview
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ ValidateableModel
constructor
Initializer.
-
#persisted? ⇒ Boolean
Overload persisted?.
Constructor Details
#initialize(attributes = {}) ⇒ ValidateableModel
Initializer
22 23 24 25 26 |
# File 'lib/auxiliary_addons/validateable_model.rb', line 22 def initialize(attributes={}) attributes && attributes.each do |name, value| send("#{name}=", value) if respond_to? name.to_sym end end |
Class Method Details
.attr_accessor(*vars) ⇒ Object
11 12 13 14 15 |
# File 'lib/auxiliary_addons/validateable_model.rb', line 11 def self.attr_accessor(*vars) @attributes ||= [] @attributes.concat( vars ) super end |
.attributes ⇒ Object
17 18 19 |
# File 'lib/auxiliary_addons/validateable_model.rb', line 17 def self.attributes @attributes end |
.inspect ⇒ Object
Inspect
34 35 36 |
# File 'lib/auxiliary_addons/validateable_model.rb', line 34 def self.inspect "#<#{ self.to_s} #{ self.attributes.collect{ |e| ":#{ e }" }.join(', ') }>" end |
Instance Method Details
#persisted? ⇒ Boolean
Overload persisted?
29 30 31 |
# File 'lib/auxiliary_addons/validateable_model.rb', line 29 def persisted? false end |