A collection of useful Rails generator scripts.
Add the gem to your Gemfile.
gem "railschef", :group => :development
Then you can run any of the included generators.
rails g railschef:auth User UserSession
-
Rails 3.1.x
-
Authlogic
-
railschef:layout: generates generic layout, stylesheet, and helper files.
-
railschef:auth: generates user model with sign up and log in.
To view the README for each generator, run it with the help
option.
rails g railschef:layout --help
I get “undefined method ‘title’” error.
Try running railschef:layout, that will generate this helper method. Or you can just change the templates to whatever approach you prefer for setting the title.
I can’t set new attributes in my model.
Add the attribute to the attr_accessible line in the model.
I get “undefined method ‘root_url’” error.
Some generators default redirecting to the root_url. Set this in your routes.rb file like this (substituting your controller name).
root :to => "home#index"
and make sure you have create a replacement for home when you use ‘–skip-home’ option.
I get a missing database error.
Run rake db:migrate
.
I get a routing error when I try to submit a form.
Try restarting your development server. Sometimes it doesn’t detect the change in the routing.