Closed tommybernaciak closed 8 years ago
try to use:
$ bundle exec rails g settings ...
I'm having the same issue. I tried:
$ bundle exec rails g settings:install Setting
$ bundle exec rails g settings:install
and received this error:
Running via Spring preloader in process 93821
Could not find generator 'settings:install'. Maybe you meant 'devise:install', 'cocoon:install' or 'responders:install'
Run `rails generate --help` for more options.
I'm on Rails 5 beta 3 and Ruby 2.3.
same here with Rails 4.2.5
maybe we have error, because we use Rails 4.2 and up and not Rails 4.1.x ??
# rails-settings-cached 0.5.x
$ rails g settings Setting
create app/models/setting.rb
identical db/migrate/20160408023306_create_settings.rb
# rails-settings-cached 0.6.0+ not release
$ rails g settings:install Setting
create app/models/setting.rb
identical db/migrate/20160408023306_create_settings.rb
Should this have been closed? I think it should be added to the install docs if it is so necessary. I also needed to use
rails g settings Setting
I believe this was closed in error. With rails-settings-cached (0.6.5) on rails 5.0.1, neither rails g method works.
rails 4.2.8 , I have same problem, it has solved by: gem "rails-settings-cached" , '~> 0.5.1' then,OK!
@architectcom Which command you used to generate migration file. I am on rails 4.2 and installed `gem "rails-settings-cached" , '~> 0.5.1'1 .
Still getting the error
bundle exec rails g settings:install Setting
Running via Spring preloader in process 54135
Could not find generator 'settings:install'. Maybe you meant 'devise:install' or 'config:install' or 'asset_sync:install'
Run `rails generate --help` for more options.
bundle exec rails g settings Setting
Running via Spring preloader in process 54109
Could not find generator 'settings'. Maybe you meant 'assets' or 'devise' or 'task'
@huacnlee I see few developer are still facing the issue including me. Should this bug reopened.
With latest version (0.6.6) and rails(4.2), I'm getting error
bundle exec rails g settings:install Setting
Running via Spring preloader in process 57061
[WARNING] Could not load generator "generators/settings/install_generator". Error: Settings is not a module.
/Users/rohittrivedi/.rvm/gems/ruby-2.2.1@learninglabs/gems/rails-settings-cached-0.6.6/lib/generators/settings/install_generator.rb:4:in `<top (required)>'
I guess this is happening because of there is some class/variable with name Settings
. Is there any way to overcome this issue without changing existing code? Settings
seems like a generic name, should use unique name or namespace, then ?
@huacnlee Rails 5.1.4
bundle exec rails g settings:install MySetting
Returns:
Running via Spring preloader in process 23796
[WARNING] Could not load generator "generators/settings/install_generator". Error: Settings is not a module.
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/rails-settings-cached-0.6.6/lib/generators/settings/install_generator.rb:4:in `<top (required)>'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/command/behavior.rb:82:in `block (2 levels) in lookup'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/command/behavior.rb:78:in `each'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/command/behavior.rb:78:in `block in lookup'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/command/behavior.rb:77:in `each'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/command/behavior.rb:77:in `lookup'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/generators.rb:250:in `find_by_namespace'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/generators.rb:267:in `invoke'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/commands/generate/generate_command.rb:24:in `perform'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/Users/afuno/path/to/my/app/bin/rails:9:in `<top (required)>'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/afuno/.rbenv/versions/2.4.3/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
-e:1:in `<main>'
Could not find generator 'settings:install'. Maybe you meant 'meta_tags:install', 'devise:install' or 'config:install'
Run `rails generate --help` for more options.
I had the same issue. Turns out it's probably because you already have Settings
defined in your codebase or in a gem you are using. You can confirm this by typing rails c
then Settings
.
This means the generator doesn't work, but the workaround is simple. Just go to https://github.com/huacnlee/rails-settings-cached/tree/master/lib/generators/settings/templates and copy the model and migration over to your project, making sure to rename the model and db table to something that doesn't clash.
I've added gem to Gemfile, made bundle install with no problems. Then I tried to generate model, but after 'rails g settings Packet' i got info that Could not find generator 'settings'.