I'm trying to verify that a parameter is an instance of a specific class in Rails:
def schedule(action, *args)
if arg.is_a? Aircraft
...
end
end
I'm doing this in a library class (the file is in lib/) and I get an uninitialized constant Aircraft error. Aircraft is a model class, with a corresponding aircraft.rb file in app/models.
Can I use model classes and instances in a library? How?
Error context:
The error happens in RSpec tests; the code works in the browser. I tried requiring the model in the *spec.rb file, no success at the moment.