1. Getting Started with Rails Flashcards

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

What is Rails?

A

Rails is a web application development framework written in the Ruby language. Two major guiding principles: 1. don’t Repeat Yourself and 2. convention and over configuration:

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

What is Rails?

A

Rails is a web application development framework written in the Ruby language. Two major guiding principles: 1. don’t Repeat Yourself and 2. convention and over configuration:

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

controller’s purpose

A

to receive specific requests for the application.

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

view’s purpose

A

display this information in a human readable format. view templates are written in a language called eRuby (Embedded Ruby)

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

routing file

A

which holds entries in a special DSL (domain-specific language) that tells Rails how to connect incoming requests to controllers and actions

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

resource

A

is the term used for a collection of similar objects, such as articles, people or animals. You can create, read, update and destroy items for a resource and these operations are referred to as CRUD operations.

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

resources method

A

can be used to declare a standard REST resource.

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

controller

A

is simply a class that is defined to inherit from ApplicationController. It’s inside this class that you’ll define methods that will become the actions for this controller. These actions will perform CRUD operations on the articles within our system. define an action inside a controller, all you need to do is to define a new method inside the controller.

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

:formats in error message

A

specifies the format of template to be served in response. The default format is :html, and so Rails is looking for an HTML template.

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

key, :handlers in error message

A

is telling us what template handlers could be used to render our template. :erb is most commonly used for HTML templates, :builder is used for XML templates, and :coffee uses CoffeeScript to build JavaScript templates.

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

form_for

A

is a use a form builder. primary form builder for Rails is provided by a helper method called form_for.

<br>

When you call form_for, you pass it an identifying object for this form. In this case, it’s the symbol :article. FormBuilder object - represented by f - is used to build the form.

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

form_for : pass :url option

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

params method i

A

is the object which represents the parameters (or fields) coming in from the form. The params method returns an ActiveSupport::HashWithIndifferentAccess object, which allows you to access the keys of the hash using either strings or symbols.

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

Models

A

in Rails use a singular name, and their corresponding database tables use a plural name.

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

Migrations

A

are Ruby classes that are designed to make it simple to create and modify database tables.

Rails uses rake commands to run migrations, and it’s possible to undo a migration after it’s been applied to your database. Migration filenames include a timestamp to ensure that they’re processed in the order that they were created.

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

strong parameters

A

requires us to tell Rails exactly which parameters are allowed into our controller actions. use controller parameters to prevent wrongful mass assignment. made private

17
Q

strong parameters

A

private
def article_params
params.require(:article).permit(:title, :text)
end

18
Q

frequent practice - CRUD operation order in controller

A

index, show, new, edit, create, update

and destroy.

19
Q

controller’s purpose

A

to receive specific requests for the application.

20
Q

view’s purpose

A

display this information in a human readable format. view templates are written in a language called eRuby (Embedded Ruby)

21
Q

routing file

A

which holds entries in a special DSL (domain-specific language) that tells Rails how to connect incoming requests to controllers and actions

22
Q

resource

A

is the term used for a collection of similar objects, such as articles, people or animals. You can create, read, update and destroy items for a resource and these operations are referred to as CRUD operations.

23
Q

resources method

A

can be used to declare a standard REST resource.

24
Q

controller

A

is simply a class that is defined to inherit from ApplicationController. It’s inside this class that you’ll define methods that will become the actions for this controller. These actions will perform CRUD operations on the articles within our system. define an action inside a controller, all you need to do is to define a new method inside the controller.

25
Q

:formats in error message

A

specifies the format of template to be served in response. The default format is :html, and so Rails is looking for an HTML template.

26
Q

key, :handlers in error message

A

is telling us what template handlers could be used to render our template. :erb is most commonly used for HTML templates, :builder is used for XML templates, and :coffee uses CoffeeScript to build JavaScript templates.

27
Q

form_for

A

is a use a form builder. primary form builder for Rails is provided by a helper method called form_for.

<br>

When you call form_for, you pass it an identifying object for this form. In this case, it’s the symbol :article. FormBuilder object - represented by f - is used to build the form.

28
Q

form_for : pass :url option

A
29
Q

params method i

A

is the object which represents the parameters (or fields) coming in from the form. The params method returns an ActiveSupport::HashWithIndifferentAccess object, which allows you to access the keys of the hash using either strings or symbols.

30
Q

Models

A

in Rails use a singular name, and their corresponding database tables use a plural name.

31
Q

Migrations

A

are Ruby classes that are designed to make it simple to create and modify database tables.

Rails uses rake commands to run migrations, and it’s possible to undo a migration after it’s been applied to your database. Migration filenames include a timestamp to ensure that they’re processed in the order that they were created.

32
Q

strong parameters

A

requires us to tell Rails exactly which parameters are allowed into our controller actions. use controller parameters to prevent wrongful mass assignment. made private

33
Q

strong parameters

A

private
def article_params
params.require(:article).permit(:title, :text)
end

34
Q

frequent practice - CRUD operation order in controller

A

index, show, new, edit, create, update

and destroy.