module Sequel::Plugins::FormeI18n::SequelFormI18n

  1. lib/sequel/plugins/forme_i18n.rb

Methods

Public Instance

  1. subform

Public Instance methods

subform (association, opts={}, &block)

Checks if there's a translation for the 'models.<table_name>.<association>' key and merge it to the options with the :legend key

Calls the original Sequel::Plugins::Forme::SequelForm method

[show source]
# File lib/sequel/plugins/forme_i18n.rb, line 14
def subform(association, opts={}, &block)
  i18n_key = "models.#{obj.class.table_name}.#{association}"

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

  super
end