Search code examples
ruby-on-railsruby-on-rails-5

Rails 5 ignoring /lib class?


I've used this method for modals in rails. It works really well, but I've just upgraded to Rails 5 beta3, and now it's not working in production.

I get this error:

Completed 500 Internal Server Error in 22ms (ActiveRecord: 0.9ms)

NameError (uninitialized constant ApplicationController::ModalResponder):

app/controllers/application_controller.rb:26:in `respond_modal_with'
app/controllers/tools_controller.rb:28:in `new'

Is my inheritance thrown off with Rails 5?

My class ModalResponder < ActionController::Responder is in /lib and works in development...

Looking for info on changes with rails 5, but sources are limited to my knowledge.


Solution

  • You need to add a 'require' (on application.rb) with your classes inside the lib folder.

    Like:

    require './lib/someclass'

    I recommend you put it inside a Rails plugin.