Sha256: 2f9c670493497f32358857c16342e9a6a54ea67d551ef4c8a4d3e22bf845681b
Contents?: true
Size: 785 Bytes
Versions: 1
Compression:
Stored size: 785 Bytes
Contents
require "virtus" module SuperForm class Basic include ActiveModel::Model extend ActiveModel::Naming include ActiveModel::Conversion include ActiveModel::Validations include Virtus.model class << self def form_name(name) # 定義 form name (給 form 用的) define_singleton_method :model_name do active_model_name_for(name.to_s.camelize) end end # default is forms def i18n_scope :forms end # 定義 i18n scope def i18n_prefix(i18n_scope) define_singleton_method :i18n_scope do i18n_scope.to_sym end end private def active_model_name_for(string) ::ActiveModel::Name.new(self, nil, string) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
super_tools-3.0.1 | lib/super_form/basic.rb |