Skip to content

Commit

Permalink
Copy Formtastic 2.1.1's #input_class in case user has Formtastic 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
James McKinney committed Jul 6, 2012
1 parent eaf18a4 commit 5c0d9a5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/active_admin/form_builder.rb
Expand Up @@ -125,6 +125,14 @@ def active_admin_input_class_name(as)
"ActiveAdmin::Inputs::#{as.to_s.camelize}Input"
end

# Copy Formtastic 2.1.1's #input_class in case user has Formtastic 2.2
def input_class(as)
@input_classes_cache ||= {}
@input_classes_cache[as] ||= begin
Rails.application.config.cache_classes ? input_class_with_const_defined(as) : input_class_by_trying(as)
end
end

# prevent exceptions in production environment for better performance
def input_class_with_const_defined(as)
input_class_name = custom_input_class_name(as)
Expand Down

0 comments on commit 5c0d9a5

Please sign in to comment.