Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method 'join' for nil:NilClass in authorization.rb:23 #43

Closed
tfl opened this issue Apr 21, 2010 · 6 comments
Closed

undefined method 'join' for nil:NilClass in authorization.rb:23 #43

tfl opened this issue Apr 21, 2010 · 6 comments

Comments

@tfl
Copy link

tfl commented Apr 21, 2010

after your last update 3 hours ago I now get an an error at Rails-Startup (see title)
I testet Rails.root.join("config", "authorization.rb") and it worked fine in console (without the GEM)...

Ruby 1.9.1p378
Rails Beta3 (same with Rails Beta 2)

@mjonuschat
Copy link
Contributor

This is due to Rails.root still being nil when the AUTH_DSL_FILES code gets to run during initalization.

See this ticket regarding the matter:

https://rails.lighthouseapp.com/projects/8994/tickets/4016-railsroot-returns-nil-before-app-initialization-silently-breaking-some-gems

@mjonuschat
Copy link
Contributor

I've fixed it here: http://github.com/yabawock/declarative_authorization/tree/rails3

990f62721426371cdbf7183b5f885609fb53e6af adds a railtie so that declarative_authorization integrates itself into the Rails 3 initialization process. Otherwise "initialize" will never get called and DA will not get set up

Commit bc8c699095459a26912b83b1a0a54c4298842b4f modifies the logic to find the rules file a bit:

  1. If a reader is supplied, use that
  2. If AUTH_DSL_FILES is set, use that
  3. If neither reader nor AUTH_DSL_FILES is available, look for config/authorization_rules.rb in the Rails.root

As we are in the initialize function when we are falling back on Rails.root this means that the Rails framework has been initialized and Rails.root should not be nil.

@stffn
Copy link
Owner

stffn commented Apr 22, 2010

Further fix for Rails.root being nil in plugin initialization in Rails 3.beta3

The correct approach most likely is to employ Railtie and init hooks to make sure
that Rails is initialized. Anyway, this should fix it for now.
(Closed by 032e560)

@stffn
Copy link
Owner

stffn commented Apr 22, 2010

yabawock, your approach seems like a good way to solve this problem in the future. 990f62721426371cdbf7183b5f885609fb53e6af seems to be empty, though.

@mjonuschat
Copy link
Contributor

Seems, the merging from a different branch failed.

Redid the merge, commit is 1ab1422f02c85f9334e8e3ea443887f6127ddfff

@stffn
Copy link
Owner

stffn commented Apr 22, 2010

Let's move this issue to its proper own thread: #44

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants