I'm very much a beginner, so please bare with me!
I'm using the "Learn Ruby On Rails" pdf book from learn-rails.com.
I'm at chapter 13, "Configure". Where we are supposed to do the command: "rails generate figaro:install"
In chapter 12 we installed the figaro gem,: "We’ve already installed the figaro gem in the Gemfile and run bundle install."
When I run that command I get: "Could not find generator figaro:install."
I started searching for similar questions, and I did find this question here: rails generate - "Could not find generator"
where they were recommended to include "migration" into the command as well.
I included it in my command and I got it to do something, but I don't think it's doing what it should be?
/Users/NormalUse/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/activerecord-4.0.2/lib/rails/generators/active_record/migration/migration_generator.rb:57:in `validate_file_name!': Illegal name for migration file: figaro:install (ActiveRecord::IllegalMigrationNameError)
(only lower case letters, numbers, and '_' allowed)
from /Users/NormalUse/.rvm/gems/ruby-2.0.0-p353@learn-rails/gems/activerecord-4.0.2/lib/rails/generators/active_record/migration/migration_generator.rb:10:in `create_migration_file'
As you're learning (welcome to the Rails community btw!), let me explain what Figaro does & how to use (install) it:
Like other Ruby gems in Rails, you have to add it to your
Gemfile, which lists all the plugins your app will use. According to RubyGems.org, you could list it in your Gemfile like this:
#Gemfile gem "figaro", "~> 0.7.0"
After you've added this line to your Gemfile, you need to install it. To do this, you should run
bundle install to run the bundler (installer)
Once you've done this, you need to run this command from cmd:
rails generate figaro:install
Your errors seem to indicate you've got migration problems?
Illegal name for migration file: figaro:install (ActiveRecord::IllegalMigrationNameError)
I would guess you called this command:
rake db:migrate figaro:install
If this is the case, you should perform any migrations by running
rake db:migrate and then
rails generate figaro:install. This will run the commands separately, which should help them work