Class: RansackSimpleForm::FormBuilder

Inherits:
SimpleForm::FormBuilder
  • Object
show all
Defined in:
lib/ransack_simple_form.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ FormBuilder

Returns a new instance of FormBuilder.



24
25
26
27
# File 'lib/ransack_simple_form.rb', line 24

def initialize(*args)
  super
  @ransack_form_builder = Ransack::Helpers::FormBuilder.new(*args)
end

Instance Attribute Details

#ransack_form_builderObject (readonly)

Returns the value of attribute ransack_form_builder.



22
23
24
# File 'lib/ransack_simple_form.rb', line 22

def ransack_form_builder
  @ransack_form_builder
end

Instance Method Details

#label(method, *args, &block) ⇒ Object

delegate :label, to: :ransack_form_builder



31
32
33
34
35
36
37
38
39
# File 'lib/ransack_simple_form.rb', line 31

def label(method, *args, &block)
  options = args.extract_options!
  i18n = options[:i18n] || {}
  text = object.translate(
      method, i18n.reverse_merge(:include_associations => true)
  ) if object.respond_to? :translate
  text ||= args.first
  super(method, text, options, &block)
end