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
32 def forme_form_class(base)
33   klass = super
34   klass.send(:include, SequelFormI18n)
35   klass
36 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
42 def forme_input(form, field, opts)
43   i18n_key = "models.#{self.class.table_name}.#{field}"
44 
45   if opts[:label].nil? && I18n.exists?(i18n_key)
46     opts[:label] = I18n.t(i18n_key)
47   end
48 
49   super
50 end