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
lib/
Library modules
26
lib/assets
Library assets such as cascading style sheets (CSS), JavaScript files, and images
27
log/
Application log files
28
public/
Data accessible to the public (e.g., web browsers), such as error pages
29
bin/rails
A program for generating code, opening console sessions, or starting a local server
30
test/
Application tests (made obsolete by the spec/ directory in Section 3.1)
31
tmp/
Temporary files
32
vendor/
Third-party code such as plugins and gems
33
vendor/assets
Third-party assets such as cascading style sheets (CSS), JavaScript files, and images
34
README.rdoc
A brief description of the application
35
Rakefile
Utility tasks available via the rake command
36
Gemfile
Gem requirements for this app
37
Gemfile.lock
A list of gems used to ensure that all copies of the app use the same gem versions
38
config.ru
A configuration file for Rack middleware
39
.gitignore
Patterns for files that should be ignored by Git
40
Start a rails server
> rails s
41
app/assets/
CSS and Javascript files for the app
42
app/controllers/
All the controllers that handle requests fro the app
43
app/helpers/
Helper methods for the views in the browser
44
app/mailer/
All the modules to send email from the app
45
app/models/
The models that interact the database; ActiveRecord::Base selector classes
46
app/views/
HTML templates for the app
47
Create a controller
> rails g controller CONTROLLER_NAME [methods]
48
Kill a rails server
Ctrl + C
49
Crete a database model
> rails g model TABLE_NAME [field:data_type] Models are the database tables for storing and structuring data
50
Ruby make command
> rake (rails make)
51
Create the database table from a model
> rake db:migrate
52
A variable
@variable_name
53
A hyperlink
54
Set a variable equal to all rows in a table
@variable = Table.all
55
See routes available in the system
> rake routes
56
Render with no body
head status: 503
57
Redirect method
redirect_to PAGE_URL
58
Render a template into a layout
looks for a template with the same name as the request
59
Layout tag for CSS
"all" %>
60
Layout tag for Javascript
61
Layout tag for meta data
62
Include a textbox within a form
63
Include a checkbox within a form
64
Include a date selector within a form
65
Include a submit button
66
Loop through all the items in a database table
@variable.each
67
To get input from the console
variable = gets
68
To print something to the console
puts "PRINTED"