If I have a controller that is inheriting from Devise, and I want to access a module outside of Devise (for example if I have a products model), how can I access it within the controller that is inheriting from Devise? The following gives me an NameError uninitialized constant:
class RegistrationsController < Devise::RegistrationsController
define foo
Products.find(1)
end
end
class ProductsController < ApplicationController
end
I’ve tried:
ApplicationController::Products.find(1)
ActiveRecord::Base::Products.find(1)
There is no need for such thing. Models are not inside any module.
I think you might be confused and your model class is actually
Productinstead ofProductsat least that’s how you should name it by the convension