Rails commands by function Flashcards

What's the quick command to open the rails console for the current RAILS_ENV? Memorize these so you can become a faster, smarter Rails programmer

1
Q

Name the Rails command that:

Creates a new application

A

rails new ApplicationName

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Name the Rails command that:

Creates a model with the specified model_name

A

rails generate/g model ModelName

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Name the Rails command that:

Creates a controller with the specified controller_name

A

rails generate/g controller ControllerName

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Name the Rails command that:

Creates a migration with the specified migration_name

A

rails generate/g migration MigrationName

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Name the Rails command that:

Provides a shortcut for creating your controller, model and view files etc.

A

rails generate/g scaffold ModelName ControllerName

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Name the Rails command that:

Destroys the created controller and its related file. Same way you can destroy your model, migration files etc.

A

rails destroy controller ControllerName

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Name the Rails command that:

Starts ruby server at http://localhost:3000

A

rails server/s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Name the Rails command that:

Opens the rails console for the current RAILS_ENV

A

rails console/c

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Name the Rails command that:

Opens the DB console for the current RAILS_ENV

A

rails dbconsole/db

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Name the Rails command that:

Profiles your application.

A

rake test:profile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Name the Rails command that:

Lists all available rake tasks

A

rake -T

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Name the Rails command that:

Creates the database defined in config/database.yml for the current RAILS_ENV

A

rake db:create

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Name the Rails command that:

Drops the database for the current RAILS_ENV

A

rake db:drop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Name the Rails command that:

Migrates the database through scripts in db/migrate folder.

A

rake db:migrate

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Name the Rails command that:

Drops and recreates the database from db/schema.rb for the current environment.

A

rake db:reset

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Name the Rails command that:

Runs the down method from the latest migration.

A

rake db:rollback

17
Q

Name the Rails command that:

Create a db/schema.rb file that can be portably used against any DB supported by AR

A

rake db:schema:dump

18
Q

Name the Rails command that:

Builds the RDOC HTML Files

A

rake doc:app

19
Q

Name the Rails command that:

Lists the gems that this rails application depends on

A

gem list

20
Q

Name the Rails command that:

Installs all required gems for this application.

A

bundle install

21
Q

Name the Rails command that:

Truncates all *.log files in log/ to zero bytes

A

rake log:clear

22
Q

Name the Rails command that:

Prints out all defined routes in match order, with names.

A

rake routes

23
Q

Name the Rails command that:

Runs all unit, functional and integration tests

A

rake test

24
Q

Name the Rails command that:

Runs tests for functionalsdb:test:prepare /
Run the functional tests in test/functional

A

rake test:functionals

25
Q

Name the Rails command that:

Runs tests for integrationdb:test:prepare /
Runs the integration tests in test/integration

A

rake test:integration

26
Q

Name the Rails command that:

Runs tests for unitsdb:test:prepare /
Runs the unit tests in test/unit

A

rake test:units

27
Q

Name the Rails command that:

Clears session, cache, and socket files from tmp/

A

rake tmp:clear

28
Q

Name the Rails command that:

Lists all the installed gems.

A

gem list

29
Q

Name the Rails command that:

Installs the specified gem in to your machine.

A

gem install GemName

30
Q

Name the Rails command that:

Uninstalls the specified gem from your machine.

A

gem uninstall GemName

31
Q

Name the Rails command that:

Presents a web page at http://localhost:8808/ with info about installed gems.

A

gem server

32
Q

Name the Rails command that:

Benchmarks your application.

A

rake test:benchmark