Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-3838

DEPRECATION WARNING: The `Validator#setup` instance method is deprecated and will be removed on Rails 4.2

    • Type: Icon: Task Task
    • Resolution: Done
    • 5.0.0
    • Affects Version/s: None
    • Component/s: None
    • None

      I'm getting this warning with Mongoid 4.0.0 and Rails 4.1.6:

      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
      . (called from <class:Place> at /api/app/models/place.rb:55)
      

      Here's the line of code at /api/app/models/place.rb:55:

      validates_uniqueness_of :factual_id
      

      So, it appears to be an issue with the Mongoid::Validatable::UniquenessValidator.

      It looks like the setup method was removed in Mongoid 4.0.0, so I don't understand why this is happening. Any ideas?

            Assignee:
            Unassigned Unassigned
            Reporter:
            wyattisimo Jared Wyatt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: