Understanding Ruby On Rails in 10 Tweets
goyal-aman
Posted on January 5, 2021
Introduction
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.
By the end, you will have a brief understanding of Ruby On Rails.
-
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 Rails15:55 PM - 04 Jan 2021 -
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 need15:55 PM - 04 Jan 2021 -
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.15:55 PM - 04 Jan 2021 -
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!15:55 PM - 04 Jan 2021 -
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.15:55 PM - 04 Jan 2021 -
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.15:55 PM - 04 Jan 2021 -
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.15:55 PM - 04 Jan 2021 -
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.15:56 PM - 04 Jan 2021 -
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.15:56 PM - 04 Jan 2021 -
🔟. 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.15:56 PM - 04 Jan 2021
Concolusion
Ruby on Rails is, as I think of it, is very similar to Django and very fun. Coming across those tweets by @willjohnsonio on Twitter I couldn't resist sharing them here.
PS: You can find him here on twiiter and here here on dev
💖 💪 🙅 🚩
goyal-aman
Posted on January 5, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.