Railtie and Engine for Rails 3 #44

stffn opened this Issue Apr 22, 2010 · 4 comments


None yet

3 participants


According to e.g. https://gist.github.com/e139fa787aa882c0aa9c we need to subclass Engine to enable the registration of the authorization development backend when decl_auth is integrated as gem in Rails 3.

One approach is in 1ab1422f02c85f9334e8e3ea443887f6127ddfff

Which other features of Engine/Railtie should we be using? Register config hooks?


I haven't looked into all the configuration options available in DA yet, but from the top of my head I would see these two options on the top of the list

1) Get initializer to run under Rails3. I don't mind if it's done the way HAML 2.2.x does it with an init_rails method getting called from vendor/plugins/haml or by subclassing Engine. If it's going to be done the vendor/plugins way, generators for Rails2 and Rails3 should be added to DA.

2) Add a config hook for the authorization rules file(s). I think it would be much cleaner than setting constants early on in the rails boot process.


On (1): not sure, how my environment can be different from yours, but in my case I don't need the explicit railtie to have decl_auth working as a gem in Rails 3. Anyway, I pushed your commit. Hopefully, this helps.


Thank you, works as charm now with the "official" version. I don't know what's different either, but I can consistently reproduce it on three machines just using Rails3 + DA, no other Gems involved.

I'll try it on a different OS just for fun, as all test machines are Macs.


I worked around this by adding the following to my config/initializers/application.rb file:

module Authorization
  AUTH_DSL_FILES.replace([Pathname.new(Rails.root || '').join("config", "authorization_rules.rb").to_s])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment