Rails Flashcards

1
Q

Where are links managed in rails?

A

routes.rb

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

Where is the Rails API found?

A

api.rubyonrails.org

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

How do you get started with rails?

A

gem install rails;rails new myapp;cd myapp;rails server

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

Template files where ruby and html code co-exist?

A

.erb files

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

How do you display an image link?

A

0), :action => ‘about’ %>

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

Where are gems needed for a web application listed?

A

Gemfile

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

How do you install all gems listed in Gemfile?

A

bundle install

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

How do you start the server? What port will it listen on by default?

A

rails server; runs on port 3000 by default

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

How do you get started with (install) heroku?

A

gem install heroku

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

How do you upload your SSH pulic key to heroku?

A

heroku keys:add

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

How do you setup your heroku remote applicatino?

A

heroku create

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

How do you push your master branch to heroku remote?

A

git push heroku master

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

How do you renamge your heroku app

A

giving it a new [name].heroku.com?,heroku rename superName

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

What does ReST stand for?

A

Representational State Transfer

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

How do you get rails to automatically generate User with id, name, email?

A

rails generate scaffold User name:string email:string

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

How do you create a class “Task” that extends from ActiveRecord?

A

class Task < ActiveRecord::Base

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

How do you get all the names as an array?

A

find(:all).collect(&:name)

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

How do you prevent an attribute (admin) from being set via mass assignment?

A

attr_protected :admin

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

app/

A

Core application (app) code, including models, views, controllers, and helpers

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

app/assets

A

Applications assets such as cascading style sheets (CSS), JavaScript files, and images

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

bin/

A

Binary executable files

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

config/

A

Application configuration

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

db/

A

Database files

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

doc/

A

Documentation for the application

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

lib/

A

Library modules

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

lib/assets

A

Library assets such as cascading style sheets (CSS), JavaScript files, and images

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

log/

A

Application log files

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

public/

A

Data accessible to the public (e.g., web browsers), such as error pages

29
Q

bin/rails

A

A program for generating code, opening console sessions, or starting a local server

30
Q

test/

A

Application tests (made obsolete by the spec/ directory in Section 3.1)

31
Q

tmp/

A

Temporary files

32
Q

vendor/

A

Third-party code such as plugins and gems

33
Q

vendor/assets

A

Third-party assets such as cascading style sheets (CSS), JavaScript files, and images

34
Q

README.rdoc

A

A brief description of the application

35
Q

Rakefile

A

Utility tasks available via the rake command

36
Q

Gemfile

A

Gem requirements for this app

37
Q

Gemfile.lock

A

A list of gems used to ensure that all copies of the app use the same gem versions

38
Q

config.ru

A

A configuration file for Rack middleware

39
Q

.gitignore

A

Patterns for files that should be ignored by Git

40
Q

Start a rails server

A

> rails s

41
Q

app/assets/

A

CSS and Javascript files for the app

42
Q

app/controllers/

A

All the controllers that handle requests fro the app

43
Q

app/helpers/

A

Helper methods for the views in the browser

44
Q

app/mailer/

A

All the modules to send email from the app

45
Q

app/models/

A

The models that interact the database; ActiveRecord::Base selector classes

46
Q

app/views/

A

HTML templates for the app

47
Q

Create a controller

A

> rails g controller CONTROLLER_NAME [methods]

48
Q

Kill a rails server

A

Ctrl + C

49
Q

Crete a database model

A

> rails g model TABLE_NAME [field:data_type] Models are the database tables for storing and structuring data

50
Q

Ruby make command

A

> rake (rails make)

51
Q

Create the database table from a model

A

> rake db:migrate

52
Q

A variable

A

@variable_name

53
Q

A hyperlink

A
54
Q

Set a variable equal to all rows in a table

A

@variable = Table.all

55
Q

See routes available in the system

A

> rake routes

56
Q

Render with no body

A

head status: 503

57
Q

Redirect method

A

redirect_to PAGE_URL

58
Q

Render a template into a layout

A

looks for a template with the same name as the request

59
Q

Layout tag for CSS

A

“all” %>

60
Q

Layout tag for Javascript

A
61
Q

Layout tag for meta data

A
62
Q

Include a textbox within a form

A
63
Q

Include a checkbox within a form

A
64
Q

Include a date selector within a form

A
65
Q

Include a submit button

A
66
Q

Loop through all the items in a database table

A

@variable.each

67
Q

To get input from the console

A

variable = gets

68
Q

To print something to the console

A

puts “PRINTED”