module Sequel::Plugins::FormeI18n::InstanceMethods

  1. lib/sequel/plugins/forme_i18n.rb

Methods

Public Instance

  1. forme_form_class
  2. forme_input

Public Instance methods

forme_form_class(base)

Includes the SequelFormI18n methods on the original returned class

[show source]
   # File lib/sequel/plugins/forme_i18n.rb
34 def forme_form_class(base)
35   klass = super
36   klass.send(:include, SequelFormI18n)
37   klass
38 end
forme_input(form, field, opts)

Checks if there’s a translation for the ‘models.<table_name>.<field>’ key and merge it to the options with the :label key

Calls the original Sequel::Plugins::Forme method

[show source]
   # File lib/sequel/plugins/forme_i18n.rb
44 def forme_input(form, field, opts)
45   i18n_key = "models.#{self.class.table_name}.#{field}"
46 
47   if opts[:label].nil? && I18n.exists?(i18n_key)
48     opts[:label] = I18n.t(i18n_key)
49   end
50 
51   super
52 end