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, line 32
def forme_form_class(base)
  klass = super
  klass.send(:include, SequelFormI18n)
  klass
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, line 42
def forme_input(form, field, opts)
  i18n_key = "models.#{self.class.table_name}.#{field}"

  if opts[:label].nil? && I18n.exists?(i18n_key)
    opts[:label] = I18n.t(i18n_key)
  end

  super
end