Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
this patch allowed to use a proc to :label option, then we can pass a proc to ActiveAdmin `filter` method
# ActiveAdmin use Formtastic as the "filter" field builder
# this patch allowed to use a proc to :label option, then we can pass a proc to `filter` method
# e.g.: filter :foo, :label => proc { I18n.tr('activerecord.attributes.foo.bar') }
module Formtastic
class Localizer
def localize_with_proc_value(key, value, type, options = {})
if value.is_a?(::Proc)
value.call(key)
else
localize_without_proc_value(key, value, type, options = {})
end
end
alias_method_chain :localize, :proc_value
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment