----sets the location and type of your databbase as well as a few other settings (like how long messages will be recorded)
1.a fixture
2.unit test
3.an action
4.an environment
.Describe the TDD cycle.
1.An array uses indices and a hash uses "keys"
2.It's a test that simulates a browser accessing our application.
3.Red, Green, Refactor,Red refers to writing a failing test,Green refers to writing a passing test Once we have a passing test we are free to refactor the code.
4.This maps requests for the URL /pages/home to the home action in the Pages controller.
.Does Ruby on Rails make app development easier?
1.Yes, It does
2.No, It doesn't
3.No Idea
4.none
.how do you check the logged in user's id?
1.status
2.session[:user_id]
3.t.errors
4.the attribute
.how do you make a link?
1.the attribute
2.<%= csrf_meta_tag %>
3. <%= link_to ... %>
4.<%= stylesheet_link_tag :all %>
.how includes all stylesheet files?
1.<%= javascript_include_tag :defaults %>
2.<%= csrf_meta_tag %>
3.<%= link_to ... %>
4. <%= stylesheet_link_tag :all %>
.show errors in object "t"
1.@tweet
2.t.presence
4.t.status
.What does the routes.rb file do with "get pages/home"?
1.When a request is made for, say, /pages/home, the Pages controller executes the code in the "home" action and then automatically renders the view corresponding to the action -- in this case, home.html.erb.
2.This maps requests for the URL /pages/home to the home action in the Pages controller.
3.When the order matters, use an array.
4.It's a test that simulates a browser accessing our application.
.Who wrote Ruby on Rails?
1.Gudo Rossum
2.Yukihiro Matsumoto
3.David Hansson
4.None of these
A form bound to a model object is called -------.
1.form_for
2.model form
3.an action
4.a fixture
Describe a "symbol" in Rails?
1.Ruby complains if we try to evaluate an undefined local variable, but issues no such complaint for an instance variable; instead, instance variables are nil if not defined
2.Symbols look kind of like strings, but prefixed with a colon instead of surrounded by quotes. For example, :name is a symbol. You can think of symbols as basically strings without all the extra baggag
3.An array uses indices and a hash uses "keys"
4.This is not a standard rails directory, but a directory installed by RSpec in which all test files are kept.
how is authenticity token works?
1.where url requests come through
2.fragments of pages that are stored in separate files
3.embedded ruby code in templates
4. used by Rails to ensure that a request comes from a Rails-generated page
how do you define a "status" parameter (within a "tweet" parameter)?
1.code = tweet,url = /tweets/1
2.@tweet = Tweet.create(:status => params[:status])
3. params = {:tweet => {:status => "I'm dead" }}
4.@tweet = Tweet.create(:status => params[:tweet][:status])
how do you do validate to ensure ":status" exists and that it's length is at least 3 long?
1.validates :status, :presence => true, :length => {:minimum => 3}
2.params = {:tweet => {:status => "I'm dead" }}
3.<%= stylesheet_link_tag :all %>
4.code = tweet, :method => :delete url = /tweets/1
how do you make a link to a zombie's profile with the text of a zombies name?
1.<%= link_to tweet.zombie.name, zombie_path(tweet.zombie) %>
2.<%= javascript_include_tag :defaults %>
3.<%= link_to ... %>
4.<%= stylesheet_link_tag :all %>
how do you make sure your forms don't get hacked?
1.<%= stylesheet_link_tag :all %>
2.<%= csrf_meta_tag %>
3.<%= link_to ... %>
4.tweets_path
How does a local variable differ from an instance variable when empty?
1.This is not a standard rails directory, but a directory installed by RSpec in which all test files are kept.
2.The @ indicates that this is an "instance variable". An instance variable defined in the action (or function) of a controller is automatically available in the view of that same name.
3.It's a test that simulates a browser accessing our application.
4. Ruby complains if we try to evaluate an undefined local variable, but issues no such complaint for an instance variable; instead, instance variables are nil if not defined
How to create multiple hashes inside "params" (like "status" within "tweet")?
1. params = {:tweet => {:status => "I'm dead" }}
2.@tweet = Tweet.create(:status => params[:status])
3.code = tweet, :method => :delete url = /tweets/1
4.@tweet = Tweet.create(:status => params[:tweet][:status])
How to includes all javascript?
1.<%= stylesheet_link_tag :all %>
2. <%= javascript_include_tag :defaults %>
3.<%= csrf_meta_tag %>
4.<%= link_to ... %>
how you start a form that doesn't match a model object
1.unit test
2. form_tag
3.a fixture
4.form_for
how you start a form that matches a model object?
1.form_tag
2.model form
3. form_for
4.a fixture
In Rails, a test of a model class is called ----------------.
1.a fixture
2.functional test
3.an action
4. unit test
In Rails, a test of an individual controller is called ------------------.
1.an action
2.functional test
3.integration test
4.unit test
let's say you have a method... def get_tweet @tweet = Tweet.find(params[:id]) end how do you tie an action to that that only kicks in for the edit, update, and destroy methods?
1.index, show, new, edit, create, update, destroy
2.code = tweet, :method => :delete url = /tweets/1
3. before_filter :get_tweet, :only => [:edit, :update, :destroy]
4.@tweet = Tweet.create(:status => params[:tweet][:status])
Name two ways to indicate a "block" in Rails
1.This maps requests for the URL /pages/home to the home action in the Pages controller.
2.The request hits the rails router which dispatches to the proper controller action. In this case, it goes to the index action in the Users controller.
3. Curly braces or do..end. It's best to use curly braces for short one-line blocks and the do..end for mult-iline blocks.
4.When the order matters, use an array.
what are the main principles of REST?
1.1. all important data is a resource, 2. every resource has a proper name (URL), 3. you can perform a standard set of operations on resources (usually CRUD), 4. client and server talk statelessly
2.model names are singular, controller (and table) names are plural
3.a script that alters the structure of the underlying database
4.no. arrays just keep references to objects stored in memory.
what code generates the url "/tweets"?
1.new_tweet_path
2.a flash
3.@tweet
4. tweets_path
what code generates the url "/tweets/new"? (action = new tweet form)
1.tweets_path
2.@tweet
3.new_tweet_path
4.Embedded Ruby
what do you use to send messages to the user?
1.t.errors
2.status
3. a flash
4.@tweet
what do you write to indicate that a tweet from table "tweets" only belongs to one zombie? (from table "zombies")? a) class Tweet validates_presence_of :status end
1.class Tweet validates_presence_of :status end
2.class Zombie < ActiveRecord::Base has_many :tweets end
3.class Tweet < ActiveRecord::Base belongs_to :zombie end
4.class TweetsController < ApplicationController ...
what does "erb" stand for in file_name.erb?
1.Error ruby
2.Embedded Ruby
3.Enchanter ruby
4.Extract ruby
What does DRY mean?
1.Don't rub yourself
2.Don't repeat yourself
3.Don't redo yourself
4.None of These
what file corresponds to the "show" method
1. a) new_tweet_path
2. /app/views/tweets/show.html.erb
3.tweets_path
4.the attribute
What is a .erb file?
1.The "erb" stands for "Embedded RuBy". .erb files look like about.html.erb and live in the "views" directory.They are just html files with embedded ruby in them.
2.The @ indicates that this is an "instance variable". An instance variable defined in the action (or function) of a controller is automatically available in the view of that same name.
3.puts (pronounced "put-ess")
4.It's a test that simulates a browser accessing our application.
What is a Class?
1.An array uses indices and a hash uses "keys"
2.Classes are simply a convenient way to organize functions (also called methods). In pages_controller.rb, PagesController is a Class which holds a "home" action.
3.A controller is a container for a group of (possibly dynamic) web pages.
4.This maps requests for the URL /pages/home to the home action in the Pages controller.
What is a controller?
1.A controller is a container for a group of (possibly dynamic) web pages.
2.An array uses indices and a hash uses "keys"
3.It's a test that simulates a browser accessing our application.
4.When the order matters, use an array.
what is a layout?
1.a tag containing a piece of ruby code
2.the set of operations that a Rails app carries out in response to a request from a user
3.fragments of pages that are stored in separate files
4. this defines an html wrapper for all of the templates belonging to a particular model
What is an integration test?
1. It's a test that simulates a browser accessing our application.
2.When the order matters, use an array.
3.puts (pronounced "put-ess")
4.An array uses indices and a hash uses "keys"
what is called a set of test data?
1.an action
2. a fixture
3.form_tag
4.unit test
what is partial page templates (or partials)?
1.another term for hash
2.embedded ruby code in templates
3.a tag containing a piece of ruby code
4. fragments of pages that are stored in separate files
What is Ruby on Rails?
1.Web application framework
2.PHP framework
3.Train loaded with Rubies
4.None of the above
What is scriptlet?
1. a tag containing a piece of ruby code
2.an environment
3.another term for hash
4.integration test
What is the /spec directory in rails?
1.Ruby complains if we try to evaluate an undefined local variable, but issues no such complaint for an instance variable; instead, instance variables are nil if not defined
2.Symbols look kind of like strings, but prefixed with a colon instead of surrounded by quotes. For example, :name is a symbol. You can think of symbols as basically strings without all the extra baggag
3.This is not a standard rails directory, but a directory installed by RSpec in which all test files are kept.
4.This maps requests for the URL /pages/home to the home action in the Pages controller.
What is the command to print to the screen?
1.When the order matters, use an array.
2.An array uses indices and a hash uses "keys"
3.It's a test that simulates a browser accessing our application.
4.puts (pronounced "put-ess")
What is the main benefit that a Class gets by inheritance from ApplicationController?
1.An array uses indices and a hash uses "keys"
2. When a request is made for, say, /pages/home, the Pages controller executes the code in the "home" action and then automatically renders the view corresponding to the action -- in this case
3.When the order matters, use an array.
4.This maps requests for the URL /pages/home to the home action in the Pages controller.
What is the most special aspect of nil?
1.This maps requests for the URL /pages/home to the home action in the Pages controller.
2.A controller is a container for a group of (possibly dynamic) web pages.
3.When the order matters, use an array.
4.Other than the object "false" itself, nil is the only object that defaults to false.
What is the status code for "success" when throwing a GET?
1.300
2.200
3.400
4.150
What kind of object is "@title" and what is special about it in Rails?
1.It's a test that simulates a browser accessing our application.
2.The "erb" stands for "Embedded RuBy". .erb files look like about.html.erb and live in the "views" directory.They are just html files with embedded ruby in them.
3.Ruby complains if we try to evaluate an undefined local variable, but issues no such complaint for an instance variable; instead, instance variables are nil if not defined
4.The @ indicates that this is an "instance variable". An instance variable defined in the action (or function) of a controller is automatically available in the view of that same name.
what test that tests the whole system?
1.an environment
2.functional test
3.integration test
4.unit test
What's the best way to describe an object in Ruby?
1.An array uses indices and a hash uses "keys"
2. It's easier to describe what objects do, which is respond to messages. An object like a string, for example, can respond to the message length, which returns the number of characters in the stri
3.This maps requests for the URL /pages/home to the home action in the Pages controller.
4.It's a test that simulates a browser accessing our application.
What's the difference between a hash and an array?
1. An array uses indices and a hash uses "keys"
2.When the order matters, use an array.
3.It's a test that simulates a browser accessing our application.
4.puts (pronounced "put-ess")
When is it best to use an array rather than a hash?
1.An array uses indices and a hash uses "keys"
2.puts (pronounced "put-ess")
3.Red refers to writing a failing test
4.When the order matters, use an array
which web application that integrates data and services from other places on the web
1.a fixture
2.an action
3.form_for
4. mashup