🔥 Learn Ruby On Rails in 10 tweets! 🔥
1️⃣ Ruby on Rails is a full-stack web app building framework made with the Ruby programming language.

Ruby has clean, simple syntax without tons of parenthesis, brackets, or semi-colons

@github @Shopify @Calendly @ThePracticalDev @eggheadio & @ConvertKit were built using Rails
2️⃣. Rails use the MVC(Model. View. Controller) programming pattern to organize and separate your code.

This makes it easier to know where things are and how they are connected which gives you more time to focus on building features users need
3️⃣. Models represent the data in your apps.

You define models to make sure any new models match before being saved.

You can also associate different models with each other. For example users and their comments and/or articles.
4️⃣ Views is what gets displayed to users. It's written just like plain HTML

You can you embedded Ruby(eRB) to put Ruby code inside of your views to display data from the database. You can display multiple users username writing just one line of code!
5️⃣ Controllers are where you tell your app what to do with your data and what to show to your views.

You can grab all users from the database and tell Rails to display them after a user logs-in or click a link to the user index page.
6️⃣. Partials are Views you can share to keep you from re-writing the same code multiple times.

A user sign-up and user edit are both forms with emails, passwords, etc.

You can write the form once and use it in any view with the render keyword and eRB syntax.
7️⃣. Helpers are another way Rails keeps you from rewriting the same code.

Rails has built-in helpers for common things like formatting numbers. You can make your own helpers in the app/helpers folder and use them in your views with eRB.
8️⃣. Testing is made easy in Rails.

A test folder is made with each new Rails app.

Each time you create a new model or controller it creates a test file as well.

Testing library minitest is built in. Use the test method with assertions to check for expected outcomes.
9️⃣. Gems are like plugins you add to Rails to gain new functionality.

Some gems handle complex things like authentication and payments. Gems are located in Gemfile in the root of your Rails app.
🔟. Routing tells your application where things go.

Each path is linked to an action inside the controller.

The users path shows all users which is linked to the index action inside the controller. Which matches the users index view.
That's it! Those are the basics of how Ruby on Rails works!

I blog about Rails at https://williamjohnson.dev/ 

I post Rails screencasts at http://egghead.io/instructors/wi 
Here’s a link to the first tweet if you want to retweet this thread https://twitter.com/willjohnsonio/status/1346123106033786880
You can follow @willjohnsonio.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.