rails / arel

A Relational Algebra
2.06k stars 390 forks source link

casted.rb:14: warning: instance variable @class not initialized #441

Closed pas256 closed 8 years ago

pas256 commented 8 years ago

When using Ruby 2.3.0 with Rails 5.0.0 and rspec 3.5.0, I am seeing a lot of

/Users/..../gems/arel-7.1.0/lib/arel/nodes/casted.rb:14: warning: instance variable @class not initialized

when running rspec on a model. I believe the model class is pretty basic right now:

class Account < ApplicationRecord
  acts_as_paranoid
  has_secure_password

  auto_strip_attributes :username

  validates :username, presence: true, length: { in: 3..20 },
    format: {
      with: /\A[a-zA-Z][a-zA-Z0-9\-_]+\z/,
      message: "%{value} is not a valid username. It must start with a letter and only contain letters, numbers, underscore(_) and dash(-)"
    },
    uniqueness: {
      message: "%{value} is already taken and must be unique.",
      case_sensitive: false,
      conditions: -> { where(deleted_at: nil) }
    },
    exclusion: {
      in: %w(admin administrator user),
      message: "%{value} is a reserved username."
    }
end

but every single test produces 4 of these warnings.

I would like to submit a PR and fix this, but I get the sense the error may be somewhere else. Any ideas on where to look? What could cause this?

yahonda commented 8 years ago

I think it will be fixed by #426 once it get merged.

pas256 commented 8 years ago

Fantastic. I will close this now.