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

Aegis 2.0: uninitialized constant Aegis::Resource #5

Closed
marceldegraaf opened this issue May 8, 2010 · 2 comments
Closed

Aegis 2.0: uninitialized constant Aegis::Resource #5

marceldegraaf opened this issue May 8, 2010 · 2 comments

Comments

@marceldegraaf
Copy link

After installing Aegis 2.0 today, I noticed that my application crashed when Aegis was hit (e.g. when the view calls a "may_index_foo?" method). The error stack trace is as follows:

ActionView::TemplateError (uninitialized constant Aegis::Resource) on line #6 of app/views/shared/_menu.html.haml:
4:   /- menu_item :groups, groups_path
5:   - menu_item :contact, contacts_path
6:   - menu_item :admin, admin_path if current_user && current_user.may_index_dashboards?

    vendor/bundler_gems/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:440:in `load_missing_constant'
    vendor/bundler_gems/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
    vendor/bundler_gems/ruby/1.8/gems/aegis-2.0.0/lib/aegis/permissions.rb:152:in `compile'
    vendor/bundler_gems/ruby/1.8/gems/aegis-2.0.0/lib/aegis/permissions.rb:85:in `find_action_by_path'
    vendor/bundler_gems/ruby/1.8/gems/aegis-2.0.0/lib/aegis/permissions.rb:108:in `query_action'
    vendor/bundler_gems/ruby/1.8/gems/aegis-2.0.0/lib/aegis/permissions.rb:52:in `may?'
    vendor/bundler_gems/ruby/1.8/gems/aegis-2.0.0/lib/aegis/has_role.rb:66:in `send'
    vendor/bundler_gems/ruby/1.8/gems/aegis-2.0.0/lib/aegis/has_role.rb:66:in `method_missing_with_aegis_permissions'
    app/views/shared/_menu.html.haml:6:in `method_missing'
...

This issue is fixed by adding this line to the file /aegis-2.0.0/lib/aegis.rb:

require 'aegis/resource'

However, as I'm using Bundler, this fix is undone every time I deploy my code to the server. Can you verify that this is an issue and if so, apply the fix to your code?

My environment:

Rails 2.3.5
Ruby 1.8.7 patchlevel 174
Aegis 2.0.0

Thanks!

@triskweline
Copy link
Member

Thyraon, I pushed a new gem version 2.0.1 that includes your patch. I also added a test so we'll never forget to require a file again.

@marceldegraaf
Copy link
Author

That's awesome, thanks for your quick response!

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

2 participants