First off, the exception in question:
undefined method '_view_paths' for nil:NilClass`
The related routes:
get 'payments/index' => 'payments#index'
get 'payments/class' => 'payments#class'
get 'payments/kids' => 'payments#kids'
get 'payments/donate' => 'payments#donate'
The associated controller:
class PaymentsController < ApplicationController
def index
end
def class
end
def kids
end
def donate
end
end
So, the exception occurs every time I try to access one of the routes. The views for the routes described above are the simple ones generated with scaffolding and use no other rails API calls. I can’t seem to find any other information on this ‘_view_paths’ method. The only assumption I can make thus far is that the proper view isn’t being found, but all views reside exactly where expected according to rails conventions (app/views/payments/*).
Has anyone stumbled upon this issue and found a solution?
You can’t define a method named “class” as it’s already a reserved method to refer to the object’s
class, for example:Technically I suppose you can override it (as you have), but doing so is mostly likely going to have some bizarre consequences unless you know what you’re doing.
The error is probably happening when the code tries to call something like
self.class._view_paths. It expects to be callingPaymentsController._view_paths. However, you’ve overridden the instance methodclasswith an empty method returningnil, hence thenilexception.