adzap / validates_timeliness

Date and time validation plugin for ActiveModel and Rails. Supports multiple ORMs and allows custom date/time formats.
MIT License
1.59k stars 227 forks source link

Rails 4.1 deprecates Validator#setup method #113

Closed mjonuschat closed 10 years ago

mjonuschat commented 10 years ago

Using the gem with Rails 4.1.0.rc1 results in the following deprecation warning:

DEPRECATION WARNING: The Validator#setup instance method is deprecated and will be removed on Rails 4.2. Do your setup in the constructor instead:

class MyValidator < ActiveModel::Validator
  def initialize(options={})
    super
    options[:class].send :attr_accessor, :custom_attribute
  end
end
jaredbeck commented 10 years ago

114 may be a duplicate of this issue, but contains a solution. Maybe we can close this issue and move the discussion to #114 ?

mjonuschat commented 10 years ago

Yeah, i'll be closing this - no need to pollute the issues with duplicates since I'm indifferent to the approach for a workaround. I've been using something along the lines of yabawock/validates_timeliness@7f029097e7605f91adaf92268e2ffa881e328def for a while, just never got around to making it public.