Hello and welcome to Rails!
Hello and welcome to Rails! So nice to have you. In this short course, we're going to cover all the fundamentals of how a Rails app fits together.
What is Rails?
Ruby on Rails is a rapid application development framework with an emphasis on configuration over convention. There's a place for everything, and there's always a "right way" to solve any particular problem. We call this the Rails way.
Rails was created by David Heinemeier Hansson (DHH) as a platform for Basecamp. He built it at a time when developers had to choose between heavyweight enterprise frameworks with sensible patterns but slow deployment cycles, and lightweight but poorly architected PHP based solutions.
Rails walks a middle ground. It's sensibly arranged, so it stays tidy, but it's lightening fast to develop with.
Who uses Rails
Rails is used extremely widely. It is favoured by startups, and companies that want to iterate very quickly, because a complex app can be produced in double-quick time. It is amazing for minimum viable products.
It's used by:
- Github (web interface)
and thousands more.
What can I build with it?
Rails is geared up for CRUD based applications, where you can create, update, view and delete data. Any application that fits this pattern is good for Rails, eg.
- A blog
- A social media site
- Twitter MVP (originally built on Rails)
What is Rails bad at?
The great strength of Rails is that it allows the developer to do a lot, very fast. The trade-off here is that Rails is very heavy on the server. Hosting is typically more expensive than it would be for an equivalent PHP site for example.
This means that ultra-high throughput apps are not a very good fit. For example:
- Pokemon Go
- Twitter (after it scaled)
You certainly could build an MVP (Minimum Viable Product) for these applications though, then move to another platform is they gain traction.
What do you get with Rails?
Rails gives you a pluggable MVC architecture. MVC stands for:
- Model (where your informations and logic lives)
- View (where we turn your data into a web page (or some other front end, such as JSON, XML or CSV))
- Controller (an intermediary between the two)
In addition, Rails also gives you other components:
- Layouts (for common layout objects like helpers)
- Helpers (for when you need code in your view)
- Concerns (for sharing common functionality between models or controllers, such as security)
- Mailers (for sending email)
- Generators (for producing very large amounts of code very quickly)
- Access to a huge library of prebaked stuff (Gems) that can do pretty much anything you need.