lib/formtastic/inputs/base.rb in formtastic-2.1.1 vs lib/formtastic/inputs/base.rb in formtastic-2.2.0.rc
- old
+ new
@@ -10,30 +10,41 @@
@object = object
@object_name = object_name
@method = method
@options = options.dup
- removed_option!(:label_method)
- removed_option!(:value_method)
- removed_option!(:group_label_method)
+ warn_deprecated_option!(:value, ":input_html => { :value => '...'}")
+ warn_deprecated_option!(:hint_class, "default_hint_class configuration")
+ warn_deprecated_option!(:error_class, "default_error_class configuration")
+ warn_deprecated_option!(:group_by, ":collection option with a HTML string generated by Rails' grouped_options_for_select()")
+ warn_deprecated_option!(:group_label, ":collection option with a HTML string generated by Rails' grouped_options_for_select()")
+ warn_deprecated_option!(:find_options, "YourModel.find(...)")
end
# Usefull for deprecating options.
def warn_and_correct_option!(old_option_name, new_option_name)
if options.key?(old_option_name)
- ::ActiveSupport::Deprecation.warn("The :#{old_option_name} option is deprecated in favour of :#{new_option_name} and will be removed from Formtastic after 2.0")
+ ::ActiveSupport::Deprecation.warn("The :#{old_option_name} option is deprecated in favour of :#{new_option_name} and will be removed from Formtastic in the next version")
options[new_option_name] = options.delete(old_option_name)
end
end
+ # Usefull for deprecating options.
+ def warn_deprecated_option!(old_option_name, instructions)
+ if options.key?(old_option_name)
+ ::ActiveSupport::Deprecation.warn("The :#{old_option_name} option is deprecated in favour of `#{instructions}` and will be removed in the next version")
+ end
+ end
+
# Usefull for raising an error on previously supported option.
def removed_option!(old_option_name)
raise ArgumentError, ":#{old_option_name} is no longer available" if options.key?(old_option_name)
end
extend ActiveSupport::Autoload
+ autoload :DatetimePickerish
autoload :Associations
autoload :Collections
autoload :Choices
autoload :Database
autoload :Errors
@@ -51,9 +62,10 @@
autoload :Validations
autoload :Wrapping
include Html
include Options
+ include Database
include Database
include Errors
include Hints
include Naming
include Validations
\ No newline at end of file