I'm trying to use this command in Terminal: rails generate layout simple --force
and when I do I get this error: Could not find generator layout.
So I attempted to try to be more specific in my gemfile, and added the specific, newest version number to the file (gem 'rails_layout', ~> '1.0.5'), and still get the same error. I did a little searching and found this similar question: zurb_foundation layout generation in rails and the answer seems to say that Foundation now includes the layout generator in it's own gem? Or am I reading that wrong? Anyway, I did a gem uninstall rails_layout
and then tried the original command again. Still, no go. Same, original error of not being able to find the layout generator. I'm on Rails 4.0.2 and Ruby 2.0.0 Does anyone have any suggestions? Thank you!
You're reading the book Learn Ruby on Rails. But you're reading an out-of-date version of the book. The latest version of the book is v1.19. You'll see the correct syntax for use of the rails_layout gem is:
$ rails generate layout:install simple --force
If you check the README for the rails_layout gem you'll see the correct commands: https://github.com/RailsApps/rails_layout
The rails_layout gem gives you an easy way to set up application layout, flash messages, and navigation partials. If you don't use the generator command, you can copy the example code from the book to get what you need (the generator command gives you a shortcut). Later in the book, you'll learn how to install Foundation and set up the application layout, flash messages, and navigation partials for Foundation. You could follow the instructions on the Foundation website but again, the rails_layout gem gives you a shortcut.
In summary: Make sure you have the newest version of the book.