Objective: Rails has excellent learning resources available online. Today, you'll look at your first of many Rails Guides:
- Getting Started (through section 5.7)
- Active Record Basics (chapters 1, 2, and 5)
Get in the habit of exploring Rails Guides as you approach new topics in Rails!
-
Fork this repo, and clone it into your
develop
folder on your local machine. Create a new file calledanswers.md
. -
In a different directory (outside
intro-rails-reading
), read and complete the Getting Started tutorial steps through section 5.7 (Showing Articles). Don't worry if you don't quite understand everything you're doing yet. -
Also, read chapters 1, 2, and 5 of the Active Record Basics guide. You don't need to incorporate these into your Getting Started project; just look over the syntax.
-
As you work through the guides, answer the following questions in your
answers.md
file (in yourintro-rails-reading
directory). Each answer should be 8 words or less!
-
What is a strength of Rails (or something you like about Rails)?
-
What is the name of the server Rails comes with, and what is the name of the database it comes with?
-
What is a "resource"?
-
What is a "controller"? How is it different from a "route"?
-
In Express,
server.js
contained our routes. Where was controller logic defined in our Express projects? -
Look at
app/views/layouts/application.html.erb
. What does this file remind you of, and what does it contain? -
The
app/controllers/articles_controller.rb
file looks like this:class ArticlesController < ApplicationController def new end def create @article = Article.new(article_params) @article.save redirect_to @article end def show @article = Article.find(params[:id]) end private def article_params params.require(:article).permit(:title, :text) end end
- What does the first line
ArticlesController < ApplicationController
mean? - How does the
new
method know which view to display? - Why does
@article
have that@
?
-
What is Active Record? What was the equivalent tool we used with Express?
-
What is a "migration"?
-
List at least one question you have about Rails (can go over 8 words if needed).
- As you make code changes, frequently commit and push to GitHub.
- Once you've finished the assignment and pushed your work to GitHub, make a pull request from your fork to the original repo.