Skip to content

Instantly share code, notes, and snippets.

@cheezedigital
Last active August 29, 2015 14:02
Show Gist options
  • Save cheezedigital/ca2dd020d1073fb6fca6 to your computer and use it in GitHub Desktop.
Save cheezedigital/ca2dd020d1073fb6fca6 to your computer and use it in GitHub Desktop.
  1. What does MVC stand for? model. view. controller.
  2. What is the purpose of MVC? orgainzation
  3. What is the command you would use to generate a new rails application called "twitter"? rails new twitter
  4. Which file do you edit to add additional gems to your rails app? gemfile
  5. What is the purpose of .gitignore file? tracked files, but tells git which files to ignore.
  6. 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!
  7. What is the vendor/assets folder used for? asssets that other people make. for example. mdo makes bootstrap. therefore, it goes here.
  8. What is the command to create my initial database? rake db:create
  9. What is the name of the file where I define my home page url? routes.rb inside the config folder
  10. What does Rails.env return when developing locally? development
  11. What does Rails.root return when developing locally? the root of the application
  12. What is the command you use to do irb with the rails application preloaded for you? rails console
  13. What is the command to create a new model called Tweet with a message string? rails generate model Tweet message:string
  14. What is the command to update your database with changes rake db:migrate
  15. What is the purpose of migrations? to not step on other developers toes. to input the information provided in database. to intialize the database.
  16. 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.
  17. What is the command to generate a controller called tweets? rails generate controller Tweets
  18. 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]
  19. What is the default view templating engine in rails? .erb
  20. 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
  21. What does REST stand for?
    representational state transfer
  22. What is the purpose of rake? a way to run ruby tasks
  23. What folder can we use in our rails app to define custom rake tasks? lib task folder
  24. In rails, the method number_to_currency is a what? helper method
  25. In rails, when using a relational database, all models inherit from what class? Activerecord::Base
  26. What is the command to create a new migration file for adding location to a tweet? rails g migration add_location_to_tweet
  27. In a migration file, what is the code to add a string location to the tweets table? add_column :tweets, :location, :string
  28. In SQL, how would I query for the number of records in my tweets table? select count(*) from tweets
  29. In rails, how would I query for the number of records in my Tweet model? Tweet.count
  30. What is the command to start your rails application? rails server
  31. What port does your rails application run on by default locally? localhost:3000
  32. Name 3 types of database associations: 1 to 1 - 1 to many - many to many
  33. 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.
  34. 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.
  35. Where would you write a custom helper method? helper folder
  36. What is the SQL code for finding all tweets where the location is equal to "Salt Lake"? select * from tweets where location='salt lake';
  37. What is the rails code for finding all tweets where the location is equal to "Salt Lake"? Tweet.where("location = ?", 'Salt Lake')
  38. 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)
  39. 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
  40. I have this route tweet GET /tweets/:id(.:format) tweets#index. What two helper methods can I use? tweet_path tweet_url
  41. What does the parenthesis in a route denote? whatever is inside the () is optional. so, optional variables. creating a blog.
  42. What do the symbols in a route mean? : means variable.
  43. All pages use which HTTP verb? GET
  44. Which helper method will create an html anchor tag for us? link_to or content_tag(:a)
  45. Which helper method will create an html form tag for us? form_for() or form_tag or content_tag(:form)
  46. Which helper method will create an html password field for us? password_field_tag
  47. The instance variable @tweets can most likely be used like what data type? @tweets is most likely an array.
  48. What construct can we use in a view to write ruby code? erb tags <% %> <%= %>
  49. What is the code to iterate over a @tweets variable in a view? <% @tweets.each do |tweet| %><%= tweet.message %><% end %>
  50. What is the method to save a newly created record to the database in rails? save method
  51. What is the method to remove a record from the database in rails? destroy method
  52. What is the method to update some of the attributes of an object in rails? update_attributes
  53. Aside from a tweet, what other model could twitter possibly use? model user
  54. What is the command to see all of the urls defined in my rails application? rake routes
  55. What file do I use to update the styles for my application? assets/stylesheets/application.css.sass application.css
  56. Is your brain hurting yet? my brain is a playground, so I'm always getting hurt. so, yes!
  57. What is the current version of rails? 4.1.1
  58. When was rails created? didn't the beta come out sometime in 2004, and fully launched around the end of 2004, beginning of 05?
  59. 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.
  60. 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.
  61. What is a partial? a part of a view
  62. How can you tell a file is a partial? the name begins with a underscore _
  63. PostgeSQL is what type of database? relational
  64. Name another database engine similar to PostgreSQL. mongoDB
  65. Name a database engine that is a different type from PostgreSQL: MySQL
  66. Are you ready for the last question? nope
  67. 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
  68. Did you really think question 67 was the last? heels no
  69. What method in the the routes file do I use to define my home page? root 'site#index'
  70. What does SASS stand for? syntactically awesome style sheets. wut wut!!!! an awesome name!
  71. What is SASS used for? writing css in a more programmatic way
  72. What gem group would you put pry-rails into? group development do gem 'pry-rails' end
  73. How would you create a static "about" page? i.e. what steps would be needed?
  74. create a static pages controller
  75. create an about view in the static view pages view folder
  76. set the route rails generate controller Static home
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment