Module: Lite::Form::Helpers::Persistence

Included in:
Base
Defined in:
lib/lite/form/helpers/persistence.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



22
23
24
# File 'lib/lite/form/helpers/persistence.rb', line 22

def included(klass)
  klass.extend(ClassMethods)
end

Instance Method Details

#createObject



32
33
34
35
36
37
# File 'lib/lite/form/helpers/persistence.rb', line 32

def create
  raise Lite::Form::NotImplementedError unless defined?(create_action)
  return unless valid?

  run_callbacks(:create) { @result = create_action }
end

#persisted?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/lite/form/helpers/persistence.rb', line 28

def persisted?
  false
end

#saveObject



39
40
41
42
43
44
# File 'lib/lite/form/helpers/persistence.rb', line 39

def save
  raise Lite::Form::NotImplementedError unless defined?(save_action)
  return unless valid?

  run_callbacks(:save) { @result = save_action }
end

#updateObject



46
47
48
49
50
51
# File 'lib/lite/form/helpers/persistence.rb', line 46

def update
  raise Lite::Form::NotImplementedError unless defined?(update_action)
  return unless valid?

  run_callbacks(:update) { @result = update_action }
end