Chapter 7 Flashcards

1
Q

rails command for running test suite

A

$ bundle exec rake test

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

rails command for starting a console session where session commands are rolled back at end of session.

A

$ rails console –sandbox

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

$ rails generate model User name:string email:string

What does name:string do in this command?

A

in the migration file that this command generates, the migration will have functions which add a Name row to the db table. Entries in this row will be string objects.

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

How would you run the rails server in a different environment?

A

$ rails server –environment production

$ rails s –environment test

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

What are the three Rails environments?

A

development, test, and production

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

If you view your app running in production, it won’t work without a production database, which we can create by running rake db:migrate in production:
what is the rails command for that?

A

$ bundle exec rake db:migrate RAILS_ENV=production

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

Command for displaying a gems location.

A

$ bundle show [gem]

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

HTTP’s four fundamental operations

A

POST, GET, PATCH, DELETE

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

method for changing a resource’s attributes

A

update_attributes

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

command for resetting the database, aka wiping out all entries

A

$ bundle exec rake db:migrate:reset

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

ORM

stands for

A

Object Relational Mapper

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

Initializing an object with a hash as an argument is called:

A

Mass assignment

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

user.errors.count

what will the #count method do?

A

return the number of errors

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

Jargon word for temporary message that displays on web page

A

flash

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

rails method for constructing a form

A

form_for

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

command for showing list of all routes

A

$ rake routes

17
Q

command for running a single test

A

$ rake test TEST=[path/file]

18
Q

variant of flash method for displaying flash message on rendered pages

A

flash.now

19
Q

method for storing a cookie in client until client browser closes

A

session

20
Q

||=

what is this operator called?

A

the “or equals” operator
var ||= ‘Hi’
var is set to ‘Hi’ only if var is nil

21
Q

$ bundle exec rake test TEST=test/integration/users_login_test.rb \
> TESTOPTS=”–name test_login_with_valid_information”
________
What does this command do?

A

runs a specific single test “test_login_with_valid_information” within a specific file “users_login_test.rb”

22
Q

session.delete(:user_id)
_______
what does this accomplish?

A

This method is used to log a user out, to remove the cookie, ending the “session.”

23
Q

what is a migration?

A

a migration modifies a database to add or remove tables, columns, or entries

24
Q

$ rails generate migration add_remember_digest_to_users remember_digest:string
_______
what files will this command generate, and what will the files do?

A

creates a migration ruby file which adds the column remember_digest to a users table.

25
Q

the cookies method takes two arguments; what are they?

A

1: a value, 2: an optional expiration date