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
42 43 44 45 46 |
# File 'app/ables/tiny_support/formable.rb', line 42 def assign_attrs attrs={} attrs.each do |field, value| self.send(:"#{field}=", value) end end |
#fail? ⇒ Boolean
38 39 40 |
# File 'app/ables/tiny_support/formable.rb', line 38 def fail? !(success?) end |
#initialize(*args) ⇒ Object
29 30 31 32 |
# File 'app/ables/tiny_support/formable.rb', line 29 def initialize *args attrs = args. assign_attrs attrs end |
#success? ⇒ Boolean
34 35 36 |
# File 'app/ables/tiny_support/formable.rb', line 34 def success? self.errors.empty? end |