Rails engine: NameError: uninitialized constant Active****. Using require 'active_***' acceptable? -


i'm working rails engine uses activerecord/activejob , getting error:

nameerror: uninitialized constant activejob 

to fix this, within engine.rb added require e.g.

require 'active_job'  module mymod   class engine < ::rails::engine   ... 

however has been suggested me bad way solve problem , alternative check constant defined instead within affected method call. e.g. if defined?(activejob). less happy solution.

can suggest resources discuss this, suggest why 'require' may bad, or suggest alternate solutions?

edit: should state both solutions fix problem; matter of understanding why within rails engine rails classes (e.g. activerecord/activejob) not available unless explicitly required (which suspect engines dependencies not autoloaded) , how 'best' make them available within engine itself.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -