assessment 4 Flashcards

1
Q

How do you quickly create a controller with all the default rest actions?

A

rails g scaffold_controller Users

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

How do you validate that an attribute is one of a set of values?

A

validates :attribute, inclusion: { in: [val1, val2, …] }

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

What’s a quick way to display the flash if there are errors?

A

render flash[:errors] if flash[:errors]

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