- What does
MVC
stand for? model. view. controller. - What is the purpose of
MVC
? orgainzation - What is the command you would use to generate a new rails application called "twitter"? rails new twitter
- Which file do you edit to add additional gems to your rails app? gemfile
- What is the purpose of
.gitignore
file? tracked files, but tells git which files to ignore. - What is the
app/assets
folder used for? app assets houses the images, css, and javascript folders. video files. audio files. documents. What we create! - What is the
vendor/assets
folder used for? asssets that other people make. for example. mdo makes bootstrap. therefore, it goes here. - What is the command to create my initial database? rake db:create
- What is the name of the file where I define my home page url? routes.rb inside the config folder
- What does
Rails.env
return when developing locally? development - What does
Rails.root
return when developing locally? the root of the application - What is the command you use to do irb with the rails application preloaded for you? rails console
- What is the command to create a new model called
Tweet
with a message string? rails generate model Tweet message:string - What is the command to update your database with changes rake db:migrate
- What is the purpose of migrations? to not step on other developers toes. to input the information provided in database. to intialize the database.
- What is the job of the controller? the middle man. transferring data from the view to the model, from the model to the controller and to the view.
- What is the command to generate a controller called
tweets
? rails generate controller Tweets - Define a route for showing all the tweets in our controller and a route for showing a specific tweet: get '/tweets' => 'tweets#index' get '/tweets/:id' 'tweets#' resources :tweets, only:[:index, :show]
- What is the default view templating engine in rails? .erb
- What is the code to validate a tweet's message is reqired when making a new tweet? model level validates :message, presence: true or database leverl null:false being added to message t.string :message, null: false
- What does
REST
stand for?
representational state transfer - What is the purpose of
rake
? a way to run ruby tasks - What folder can we use in our rails app to define custom rake tasks? lib task folder
- In rails, the method
number_to_currency
is a what? helper method - In rails, when using a relational database, all models inherit from what class? Activerecord::Base
- What is the command to create a new migration file for adding location to a tweet? rails g migration add_location_to_tweet
- In a migration file, what is the code to add a string location to the
tweets
table? add_column :tweets, :location, :string - In
SQL
, how would I query for the number of records in mytweets
table? select count(*) from tweets - In
rails
, how would I query for the number of records in myTweet
model? Tweet.count - What is the command to start your rails application? rails server
- What port does your rails application run on by default locally? localhost:3000
- Name 3 types of database associations: 1 to 1 - 1 to many - many to many
- What is
params
? a hash of key/value pairs from get/post data key valued pairs. googs it, and found this. actually, this helps me understand somewhat better, but still somewhat confused in how to actually use it. http://www.example.com/?foo=1&boo=ocopus then params[:foo] would be 1 and params[:boo] would be ocotpus. - What is
flash
? a hash of key/value pairs used to display messages across actions rails uses flash to display messages. when we visit a page, and lets say we wanted to click back without using the back button, and using the clickable icon on the web app, thats considered the the flash key. - Where would you write a custom helper method? helper folder
- What is the
SQL
code for finding all tweets where the location is equal to "Salt Lake"? select * from tweets where location='salt lake'; - What is the
rails
code for finding all tweets where the location is equal to "Salt Lake"? Tweet.where("location = ?", 'Salt Lake') - What is the
rails
code for finding only a max of 5 tweets where the location begins with "Salt Lake"? Tweet.where ("location Like ?", 'Salt Lake%').limit(5) - When using a secific query over and over it's best to make it into a method. What type of method do we use? instance method and class methods are the only types of method. class method
- I have this route
tweet GET /tweets/:id(.:format) tweets#index
. What two helper methods can I use? tweet_path tweet_url - What does the parenthesis in a route denote? whatever is inside the () is optional. so, optional variables. creating a blog.
- What do the symbols in a route mean? : means variable.
- All pages use which HTTP verb? GET
- Which helper method will create an html anchor tag for us? link_to or content_tag(:a)
- Which helper method will create an html form tag for us? form_for() or form_tag or content_tag(:form)
- Which helper method will create an html password field for us? password_field_tag
- The instance variable
@tweets
can most likely be used like what data type? @tweets is most likely an array. - What construct can we use in a view to write ruby code? erb tags <% %> <%= %>
- What is the code to iterate over a
@tweets
variable in a view? <% @tweets.each do |tweet| %><%= tweet.message %><% end %> - What is the method to save a newly created record to the database in rails? save method
- What is the method to remove a record from the database in rails? destroy method
- What is the method to update some of the attributes of an object in rails? update_attributes
- Aside from a tweet, what other model could twitter possibly use? model user
- What is the command to see all of the urls defined in my rails application? rake routes
- What file do I use to update the styles for my application? assets/stylesheets/application.css.sass application.css
- Is your brain hurting yet? my brain is a playground, so I'm always getting hurt. so, yes!
- What is the current version of rails? 4.1.1
- When was rails created? didn't the beta come out sometime in 2004, and fully launched around the end of 2004, beginning of 05?
- Who created rails? DHH baby! creator or 37signals, the book rework, and remote. race car driver residing not only in the windy city, but the dude prolly has stacks of dead prezzy's, so I assume all over. oh, did I mention, he races high performance race cars as a hobby. happily married to some hotness, and I think a new born girl.
- What is the purpose of scaffolding? quick prototyping for a rails blueprint of a potential project, just establish a foundation, though not always good to use scaffolding.
- What is a partial? a part of a view
- How can you tell a file is a partial? the name begins with a underscore _
- PostgeSQL is what type of database? relational
- Name another database engine similar to PostgreSQL. mongoDB
- Name a database engine that is a different type from PostgreSQL: MySQL
- Are you ready for the last question? nope
- What is a
foreign key
used for? associate a child table to a parent table. how to relate a specific record in one table to a specific record in another table - Did you really think question 67 was the last? heels no
- What method in the the routes file do I use to define my home page? root 'site#index'
- What does SASS stand for? syntactically awesome style sheets. wut wut!!!! an awesome name!
- What is SASS used for? writing css in a more programmatic way
- What gem group would you put
pry-rails
into? group development do gem 'pry-rails' end - How would you create a static "about" page? i.e. what steps would be needed?
- create a static pages controller
- create an about view in the static view pages view folder
- set the route rails generate controller Static home
Last active
August 29, 2015 14:02
-
-
Save cheezedigital/ca2dd020d1073fb6fca6 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment