Remove more deprecated code

This commit is contained in:
Rafael Mendonça França 2012-12-27 00:40:58 -03:00
parent db7676bc38
commit 1d17f542a6
1 changed files with 2 additions and 30 deletions

View File

@ -179,43 +179,15 @@ module SimpleForm
b.use :error, :wrap_with => { :tag => :span, :class => :error }
end
## SETUP
DEPRECATED = %w(hint_tag hint_class error_tag error_class error_notification_id wrapper_tag wrapper_class wrapper_error_class components html5)
@@deprecated = []
DEPRECATED.each do |method|
class_eval "def self.#{method}=(*); @@deprecated << :#{method}=; end"
class_eval "def self.#{method}; deprecation_warn 'SimpleForm.#{method} is deprecated and has no effect'; end"
end
def self.translate=(value)
deprecation_warn "SimpleForm.translate= is disabled in favor of translate_labels="
self.translate_labels = value
end
def self.translate
deprecation_warn "SimpleForm.translate is disabled in favor of translate_labels"
self.translate_labels
end
def self.deprecation_warn(message)
ActiveSupport::Deprecation.warn "[SIMPLE_FORM] #{message}", caller
end
def self.additional_classes_for(component)
generate_additional_classes_for.include?(component) ? yield : []
end
## SETUP
# Default way to setup SimpleForm. Run rails generate simple_form:install
# to create a fresh initializer with all configuration values.
def self.setup
yield self
unless @@deprecated.empty?
raise "[SIMPLE FORM] Your SimpleForm initializer file is using the following methods: #{@@deprecated.to_sentence}. " <<
"Those methods are part of the outdated configuration API. Updating to the new API is easy and fast. " <<
"Check for more info here: https://github.com/plataformatec/simple_form/wiki/Upgrading-to-Simple-Form-2.0"
end
end
end