rails generate basics

less than 1 minute read

create controller with help and home routes

[sourcecode language="bash"]
$ rails generate controller StaticPages home help --no-test-framework

the option no-test-framework suppresses the default rspec test (or test::unit).

if you have created them by mistake, you can destroy them.

[sourcecode language="bash"]
$ rails destroy controller StaticPages home help --no-test-framework

Creating a model is the same.

[sourcecode language="bash"]
$ rails generate model Foo bar:string baz:integer
$ rails destroy model Foo


Could not find a javascript runtime.
Install node.js.