Chapter 3 - REST, Resources, and Rails Flashcards

1
Q

CRUD

A

Create, Read, Update, Delete is the classic summary of the spectrum of database operations.

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

resources

A

If you put

resources :auctions

into your config/ routes.rb file, you will have created four named routes, which, in a manner to be described in this chapter, connect to seven controller actions. And those actions have nice CRUD-like names, as you will see.

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

How to specify the request method when you generate a URL.

A
  1. The default request method is GET.
  2. In a form_tag or form_for call, the POST method will be used automatically.
  3. When you need to (which is going to be mostly with PATCH and DELETE operations), you can specify a request method along with the URL generated by the named route.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Limiting Routes Generated

A

resources :clients, except: [: index]

resources :clients, only: [: new, :create]

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

Limiting Routes Generated

A

resources :clients, except: [: index]

resources :clients, only: [: new, :create]

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

Nested Resources

A

resources :auctions do
resources :bids
end

link_to “See all bids”, auction_bids_path( auction)

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

Nested singular routes

A

For the singular routes (show, edit, destroy), you need at least two arguments:

link_to “Delete this bid”, auction_bid_path( auction, bid), method: :delete

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

Nested singular routes

A

For the singular routes (show, edit, destroy), you need at least two arguments:

2 different ways:

link_to “Delete this bid”, auction_bid_path( auction, bid), method: :delete

link_to “Delete this bid”, auction_bid_path( auction, bid), method: :delete

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

Nested singular routes

A

For the singular routes (show, edit, destroy), you need at least two arguments:

2 different ways:

link_to “Delete this bid”, auction_bid_path( auction, bid), method: :delete

link_to “Delete this bid”, auction_bid_path( auction, bid), method: :delete

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