2. Active Record Migrations Flashcards

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

Migrations

A

are a convenient way to alter your database schema over time in a consistent and easy way.They use a Ruby DSL so that you don’t have to write SQL by hand, allowing your schema and changes to be database independent.

each migration as being a new ‘version’ of the database.

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

link_to method

A

is one of Rails’ built-in view helpers. It creates a hyperlink based on text to display and where to go. Rails will use the current controller by default.

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

ActiveRecord::Base.

A

Active Record supplies a great deal of functionality to your Rails models for free, including basic database CRUD (Create, Read, Update, Destroy) operations, data validation, as well as sophisticated search support and the ability to relate multiple models to one another.

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

Validations (in model from ActiveRecord)

A

Rails can validate a variety of conditions in a model, including the presence or uniqueness of columns, their format, and the existence of associated objects.

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

render vs redirect_to

A

This rendering is done within the same request as the form submission, whereas the redirect_to will tell the browser to issue another request.

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

errors message from failing save

A
<div>
      <h2>
         prohibited
        this article from being saved:
      </h2>
      <ul>
      <li>

  </li></ul>
</div>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

pluralize

A

rails helper that takes a number and a string as its arguments. If the number is greater than one, the string will be automatically pluralized.

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

field_with_errors.

A

Rails automatically wraps fields that contain an error with a div with class field_with_errors. You can define a css rule to make them standout.

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