Skip to content
This repository

Railtie and Engine for Rails 3 #44

Open
stffn opened this Issue April 22, 2010 · 4 comments

3 participants

Steffen Bartsch Morton Jonuschat Toby Ovod-Everett
Steffen Bartsch
Owner
stffn commented April 22, 2010

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 1ab1422

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

Morton Jonuschat

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.

Steffen Bartsch
Owner
stffn commented April 23, 2010

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.

Morton Jonuschat

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.

Toby Ovod-Everett

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])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.