Skip to content

uninitialized constant ActiveAdminRole::Dsl (NameError)  #27

Open

Description

@melashu

Hello, I need your kind support

I am working on rails 7.0.5, after I install this gem and when I run bin/rails generate active_admin_role: install I got the following error

C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/active_admin_role-0.2.2/lib/active_admin_role/engine.rb:8:in `block (2 levels) in class:Engine': uninitialized constant ActiveAdminRole::Dsl (NameError)

    extend ActiveAdminRole::Dsl
                          ^^^^^
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-7.0.5/lib/active_support/lazy_load_hooks.rb:95:in `class_eval'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-7.0.5/lib/active_support/lazy_load_hooks.rb:95:in `block in execute_hook'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-7.0.5/lib/active_support/lazy_load_hooks.rb:85:in `with_execution_control'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-7.0.5/lib/active_support/lazy_load_hooks.rb:90:in `execute_hook'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-7.0.5/lib/active_support/lazy_load_hooks.rb:60:in `block in on_load'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-7.0.5/lib/active_support/lazy_load_hooks.rb:59:in `each'  
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-7.0.5/lib/active_support/lazy_load_hooks.rb:59:in `on_load'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/active_admin_role-0.2.2/lib/active_admin_role/engine.rb:7:in `block in <class:Engine>'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.5/lib/rails/initializable.rb:32:in `instance_exec'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.5/lib/rails/initializable.rb:32:in `run'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.5/lib/rails/initializable.rb:61:in `block in run_initializers'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `each'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `call'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
    from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.5/lib/rails/initializable.rb:60:in `run_initializers'      
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.5/lib/rails/application.rb:372:in `initialize!'
    from B:/Mircovers/Microvers/All Projects/JobSearch/side project/blog_post/config/environment.rb:5:in `<main>'       
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/zeitwerk-2.6.8/lib/zeitwerk/kernel.rb:38:in `require'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.5/lib/rails/application.rb:348:in `require_environment!'   
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.5/lib/rails/command/actions.rb:28:in `require_environment!'        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.5/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.5/lib/rails/commands/generate/generate_command.rb:21:in `perform'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.5/lib/rails/command/base.rb:87:in `perform'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.5/lib/rails/command.rb:48:in `invoke'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.5/lib/rails/commands.rb:18:in `<main>'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
    from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
    from bin/rails:4:in `<main>'

Activity

  1. palash-kulkarni15 commented on Nov 7, 2023

    @palash-kulkarni15

    @melashu Did you find any solution to this?

  2. melashu commented on Nov 7, 2023

    @melashu
    Author
  3. palash-kulkarni15 commented on Nov 8, 2023

    @palash-kulkarni15

    @melashu I got the solution,

    This autoload issue is compatibility issue with Rails 7. And This issue has been fixed under -
    https://github.com/activeadmin-plugins/active_admin_role/pull/24

    NOTE : This PR is merged in master branch but not yet released.

    So you can fork from the master branch and create your own repo and use it.

    Or else

    Add this line in your Gemfile, get the gem installed from its master branch. Like
    gem 'activeadmin', '>= 2.9.0', '< 3.0'
    gem "active_admin_role", git: "https://github.com/activeadmin-plugins/active_admin_role.git", branch: "master"

    This has worked for me. Cheers!

  4. melashu commented on Nov 9, 2023

    @melashu
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions