Module: TinySupport::Formable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/ables/tiny_support/formable.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#assign_attrs(attrs = {}) ⇒ Object
41 42 43 44 45 |
# File 'app/ables/tiny_support/formable.rb', line 41 def assign_attrs attrs={} attrs.each do |field, value| self.send(:"#{field}=", value) end end |
#fail? ⇒ Boolean
37 38 39 |
# File 'app/ables/tiny_support/formable.rb', line 37 def fail? !(success?) end |
#initialize(*args) ⇒ Object
28 29 30 31 |
# File 'app/ables/tiny_support/formable.rb', line 28 def initialize *args attrs = args. assign_attrs attrs end |
#success? ⇒ Boolean
33 34 35 |
# File 'app/ables/tiny_support/formable.rb', line 33 def success? self.errors.empty? end |