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



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

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
  model(name)
end

.i18n_prefix(i18n_scope) ⇒ Object

定義 i18n scope



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

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