I’m trying to create a custom class for ActiveAdmin to try and clean up code out of the controller override in my Resource file.
I have a class creditcard.rb in /lib:
class Creditcard
def initialize
1
end
end
And I have this controller code in subscriptions.rb
ActiveAdmin.register Subscription do
controller do
def update
@test=Creditcard.new
Boom. uninitialized constant Creditcard. Anyone know how to use custom classes with ActiveAdmin?
Thanks!
You might have to add the lib directory to your autoload path if you’re using Rails 3+.
You can do this by adding this line to your
application.rbfile inside of yourclass Application < Rails::Applicationdefinition: