michelson / chaskiq-newsletters

Newsletter Rails engine
http://michelson.github.io/chaskiq/
MIT License
127 stars 13 forks source link

require_dependency 'chaskiq/application_controller' #9

Closed zach-taylor closed 8 years ago

zach-taylor commented 8 years ago

Hi there,

I'm developing a Rails engine of my own, and in my research I came across this gem. I was curious what the purpose of doing require_dependency "chaskiq/application_controller" at the top of your controllers is?

Thanks!

michelson commented 8 years ago

Hi Zach , good catch , I'm not sure about it , but I think that could be related to the use of Somecontroller < ApplicationController instead of Chaskiq::ApplicationController maybe I was trying to require Chaskiq::ApplicationController but that require_dependency could be removed and see how it behaves.

zach-taylor commented 8 years ago

Thanks for the info. I think I was running into issues where ::ApplicationController was being subclassed instead of {Engine}::ApplicationController. Adding require_dependency 'engine/application_controller' seemed to fix the issue. You would think it would look for {Engine}::ApplicationController before ::ApplicationController so maybe it's a bug with Rails. I'll just have to be specific for now. Thanks

zach-taylor commented 8 years ago

Found this today, btw: https://github.com/rails/rails/pull/22112