Class: Lite::Form::Base

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Callbacks, ActiveModel::Naming, ActiveModel::Translation
Includes:
ActiveModel::Attributes, ActiveModel::Dirty, ActiveModel::Model, ActiveModel::Serialization, Helpers::Errors, Helpers::Persistence, Helpers::Propagation
Defined in:
lib/lite/form/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Persistence

#create, included, #persisted?, #save, #update

Methods included from Helpers::Errors

#errored?, included, #merge_errors!, #merge_exception!, #success?

Constructor Details

#initialize(params = {}) ⇒ Base

Returns a new instance of Base.



38
39
40
# File 'lib/lite/form/base.rb', line 38

def initialize(params = {})
  run_callbacks(:initialize) { super(params) }
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



36
37
38
# File 'lib/lite/form/base.rb', line 36

def result
  @result
end

Class Method Details

.model_nameObject



26
27
28
29
30
31
32
# File 'lib/lite/form/base.rb', line 26

def model_name
  klass = name.gsub('Form', '')
  klass = Object.const_get(klass)
  klass.model_name
rescue StandardError
  super
end