Details Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

True or false: rails g controller NAME - NAME should be plural?

A

True.

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

True or false: rails g model NAME - NAME should be plural?

A

False.

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

True or false: migration are created when a model is generated?

A

True.

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

In Ruby, how is a multi-line comment created?

A

=begin…=end

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

What does an exclamation point (!) mean in .capitalize! and other Ruby string methods?

A

If an ! is present, the existing string is destructively altered rather than a new string being spawned.

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

Ruby loops and iterators include:

A

Unless, While, Until, For

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

What’s the syntax difference between an inclusive and exclusive FOR statement?

A

Exclusive: 1…20 (three dots), inclusive 1..20 (two dots)

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

What closes a “loop do” statement?

A

Break if condition…end.

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

Syntax of a Ruby LOOP statement?

A

counter = 1; loop do…break if counter…end

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

Ruby on Rails common migration options (6):

A

default: , limit: 29, null: false, first: true, after: email, unique: true

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

Generate a migration to add columns to a table.

A

rails g migration AddTo col1:string col2:integer col3:boolean

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

Generate a migration to remove columns from a table.

A

rails g migration RemoveFrom col2:integer

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

List 5 additional migration commands.

A

rename_column :zombies, :bio, :description
rename_table :zombies, :ghouls
drop_table :zombies
change_column :zombies, age: integer, limit: 4
change_column_default :zombies, :is_admin, default: true

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

What is this syntax called? { :name => “Jon” }

A

Rocket syntax.

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

What is this syntax called { name: “Jon” }

A

Hash syntax. It’s the preferred data definition syntax in Ruby 1.9.

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

Ruby on Rails common migration options (6):

A

default: , limit: 29, null: false, first: true, after: email, unique: true

17
Q

Generate a migration to add columns to a table.

A

rails g migration AddTo col1:string col2:integer col3:boolean

18
Q

Generate a migration to remove columns from a table.

A

rails g migration RemoveFrom col2:integer

19
Q

List 5 additional migration commands.

A

rename_column :zombies, :bio, :description
rename_table :zombies, :ghouls
drop_table :zombies
change_column :zombies, age: integer, limit: 4
change_column_default :zombies, :is_admin, default: true

20
Q

What is this syntax called? { :name => “Jon” }

A

Rocket syntax.

21
Q

What is this syntax called { name: “Jon” }

A

Hash syntax. It’s the preferred data definition syntax in Ruby 1.9.

22
Q

What does RAKE NOTES do?

A

Rake notes will search through your code for comments beginning with FIXME, OPTIMIZE or TODO. The search is done in files with extension .builder, .rb, .erb, .haml and .slim for both default and custom annotations.

23
Q

What does the prefix BUNDLE EXEC do?

A

bundle exec is a bundle command to execute a script in the context of the current bundle (the one from your directory’s Gemfile).