Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Load Formtastic only if it is present

  • Loading branch information...
commit d4b3e88ff77988dad661f48429843dd6c90453c1 1 parent f286b67
@indrekj indrekj authored
Showing with 15 additions and 14 deletions.
  1. +15 −14 lib/localized_language_select.rb
View
29 lib/localized_language_select.rb
@@ -120,23 +120,24 @@ def localized_language_select(method, priority_languages = nil, options = {}, ht
end
end
-module Formtastic
- module Inputs
- class LanguageInput
- include Base
-
- def to_html
- raise "To use the :language input, please install a language_select plugin, like this one: https://github.com/jeanmartin/localized_language_select/blob/master/lib/localized_language_select.rb" unless builder.respond_to?(:language_select)
- input_wrapping do
- label_html <<
- builder.language_select(method, priority_languages, input_options, input_html_options)
+if defined?(Formtastic)
+ module Formtastic
+ module Inputs
+ class LanguageInput
+ include Base
+
+ def to_html
+ raise "To use the :language input, please install a language_select plugin, like this one: https://github.com/jeanmartin/localized_language_select/blob/master/lib/localized_language_select.rb" unless builder.respond_to?(:language_select)
+ input_wrapping do
+ label_html <<
+ builder.language_select(method, priority_languages, input_options, input_html_options)
+ end
end
- end
- def priority_languages
- options[:priority_languages] || []#builder.priority_languages
+ def priority_languages
+ options[:priority_languages] || []#builder.priority_languages
+ end
end
end
end
end
-

0 comments on commit d4b3e88

Please sign in to comment.
Something went wrong with that request. Please try again.