motor-admin / motor-admin-rails

Low-code Admin panel and Business intelligence Rails engine. No DSL - configurable from the UI. Rails Admin, Active Admin, Blazer modern alternative.
https://app.getmotoradmin.com/demo/
MIT License
762 stars 77 forks source link

Installation generator fails with error #173

Closed vilinicz closed 3 weeks ago

vilinicz commented 2 months ago

Rails 7.2 Ruby 3.3.3 motor-admin 0.4.28

Rake task rails motor:install fails with error:

NameError: uninitialized constant Rails::Generators (NameError)
Screenshot 2024-08-21 at 11 58 54

steps to reproduce:

bundle add motor-admin
rails motor:install

I also tried to run it with bundle exec rake motor:install but result is the same.

w-zygmuntowicz commented 2 months ago

@vilinicz Got the same issue, found that if I prepend the lib/motor/tasks/motor.rake file with require statement line:

require 'rails/generators'

namespace :motor do
  # ...
end

then it works again for me. Would you confirm if that works for you?

DriesS commented 3 weeks ago

@w-zygmuntowicz You can use the command as explained in the gemspec https://github.com/motor-admin/motor-admin-rails/blob/master/motor-admin.gemspec#L43

rails g motor:install && rake db:migrate

w-zygmuntowicz commented 3 weeks ago

@DriesS Hi that's the issue here, the command rails g motor:install fails with error NameError: uninitialized constant Rails::Generators (NameError). Just make sure you're running the versions specified in the issue description

DriesS commented 3 weeks ago

@DriesS Hi that's the issue here, the command rails g motor:install fails with error NameError: uninitialized constant Rails::Generators (NameError). Just make sure you're running the versions specified in the issue description

You are using rails motor:install, but you should use rails generate motor:install

w-zygmuntowicz commented 3 weeks ago

Wow It works, I didn't know that! :)

On the other hand, wouldn't it be nice if it work with both commands with or without generator part?

If not, then we should update the README.md, because it instructs to run rails motor:install without the generate part