Class: SuperForm::Reform

Inherits:
Reform::Form
  • Object
show all
Extended by:
ActiveModel::Translation
Includes:
AtomicSave
Defined in:
lib/super_form/reform.rb

Constant Summary

Constants included from AtomicSave

AtomicSave::ReformAtomicSaveError

Class Method Summary collapse

Methods included from AtomicSave

#save_with_transaction, #save_with_transaction!

Class Method Details

.form_name(name) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/super_form/reform.rb', line 24

def self.form_name(name)
  # 定義 form name (給 form 用的)
  define_singleton_method :model_name do
    active_model_name_for(name.to_s.camelize) # Reform::Form::ActiveModel
  end
  # NOTE: 這行很可能沒有作用
  model(name)
end

.i18n_prefix(i18n_scope) ⇒ Object

定義 i18n scope



16
17
18
19
20
# File 'lib/super_form/reform.rb', line 16

def self.i18n_prefix(i18n_scope)
  define_singleton_method :i18n_scope do
    i18n_scope.to_sym
  end
end