Learn basics of Ruby-on-Rails
Ruby on Rails (or just Rails) is a free, open source Web application framework, which provides coders with everything they need to build awesome applications. Learning and developing Rails framework is easy with the help of Livecoding’s interactive social coding platform. Our guide is created to help coders on any difficulty level, and for more experienced programmers, we offer a vast collection of videos, and ability to watch how other developers code live and chat with them as well. Welcome to the Livecoding.tv!
Introduction to Ruby on Rails Framework
Ruby on Rails History
David Heinemeier Hansson extracted Ruby on Rails from his work on the project management tool Basecamp at the web application company also called Basecamp. Hansson first released Rails as open source in July 2004, but did not share commit rights to the project until February 2005. In August 2006, the framework reached a milestone when Apple announced that it would ship Ruby on Rails with Mac OS X v10.5 "Leopard", which was released in October 2007.
Rails version 2.3 was released on March 15, 2009 with major new developments in templates, engines, Rack and nested model forms. Templates enable the developer to generate a skeleton application with custom gems and configurations. Engines give developers the ability to reuse application pieces complete with routes, view paths and models. The Rack web server interface and Metal allow one to write optimized pieces of code that route around Action Controller.
On December 23, 2008, Merb, another web application framework, was launched, and Ruby on Rails announced it would work with the Merb project to bring "the best ideas of Merb" into Rails 3, ending the "unnecessary duplication" across both communities. Merb was merged with Rails as part of the Rails 3.0 release.
Rails 3.2 was released on January 20, 2012 with a faster development mode and routing engine (also known as Journey engine), Automatic Query Explain and Tagged Logging. Rails 3.2.x is the last version that supports Ruby 1.8.7. Rails 3.2.12 supports Ruby 2.0.
Rails 4.0 was released on June 25, 2013, introducing Russian Doll Caching, Turbolinks, Live Streaming as well as making Active Resource, Active Record Observer and other components optional by splitting them as gems.
Rails 4.1 was released on April 8, 2014, introducing Spring, Variants, Enums, Mailer previews, and secrets.yml.
Rails 4.2 was released on December 19, 2014, introducing Active Job, asynchronous emails, Adequate Record, Web Console, and foreign keys.
Ruby on Rails Tools (Reference)
- TRACEROUTE - Traceroute is a route cleaning tool for Rails applications. It provides a simple rake task for checking which routes are mapped to non existing controller actions, and finds out which controller actions are not reachable.
You will also be required to keep your controller helper methods and various before/after filters private, since they shouldn’t be a part of the public API. It sometimes has problems with showing false positives on mountable engines, but they can be easily overlooked.
- RACK-MINI-PROFILER - This is a nice tool used for finding bottlenecks of your applications. It does a live speed analysis of how long it took for the request to be processed and how much of that time it was doing various renderings, database queries and DOM loading. Just plug it into your Gemfile and you'll get a small window in the upper left corner of your page, showing you all of these information.
- BULLET - This one particularly blew my mind. The bullet gem helps you kill all the N+1 queries, as well as unnecessarily eager loaded relations. Once you install it and start visiting various routes in development, alert boxes with warnings indicating database queries that need to be optimized will pop out. It works right out of the box and is extremely helpful for optimizing your application.
- BRAKEMAN - A security analysis tool for your Rails applications. It scans through your application and outputs a nicely formatted table of possible vulnerabilities. Security warnings are grouped according to their severity (High, Medium and Low). You can learn more about their meanings on brakeman's list of warnings.
Note that even if you end up not having any warnings, it doesn't mean that your app is secure, since brakeman sometimes overlooks some basic security pitfalls.
Security-wise, there is also a gem called bundler-audit, used for checking vulnerable versions of gems in your Gemfile.lock.
- DEADWEIGHT - Deadweight is used for cleaning unused CSS selectors. You have to hand out a set of your application's style sheets and HTML pages, and it will report which CSS selectors are safe to remove.
The gem won’t work out of the box in Rails, since most pages have dynamic content, but Jason Morrison from Thoughtbot wrote a blog post on how to create a Rack Middleware and integrate it into your test suite to collect all the HTML content in one place.
If you're using precompilers such as Sass or Less, you should compile all of your style sheets and hand them out as simple CSS files to the deadweight task. It is recommended that you remove all the vendor/third-party css files (such as Bootstrap files and similar) since they will end up clogging your output.
- RAILS BEST PRACTICES - Static code analyzer for finding Rails specific code smells. It offers a variety of suggestions; use scope access, restrict auto-generated routes, add database indexes, etc. For a full list of suggestions, check out the rails-best-pratices official page. Unfortunately, sometimes it reports lots of false positives, such as unused methods. Nevertheless, it contains lots of nice suggestions that will give you a better perspective on how to refactor your code and learn some best practices.
If you like the suggestions that rails best practices gives, you also might find Sandi Metz’s rules for developers quite interesting. You can check if your code complies to Sandi’s standards with the sandi_meter gem.
- RUBOCOP - A Ruby static code analyzer which you can use to check if your code complies with the Ruby community code guidelines. The gem reports style violations through the command line, with lots of useful code refactoring goodies such as useless variable assignment, redundant use of Object#to_s in interpolation or even unused method argument.
A good thing is that it's highly configurable, since the analyzer can be quite irritating if you're not following the Ruby style guide 100% (i.e. you have lots of trailing whitespaces or you double quote your strings even when not interpolating, etc.).
It's divided into 4 sub-analyzers (called cops): Style, Lint, Metrics and Rails. You can define which cops to use, as well as which files to exclude/include and tweak various other configuration options in a .rubocop.yml file.
- RUBYCRITIC - A relatively new gem that wraps around three static analysis gems - Reek(ruby code smells), Flay (code duplication detection) and Flog (ABC metrics). It creates nicely structured HTML files so you can browse through your smelly code and start refactoring. Out of all of the mentioned static code analysis tools, because of it's nice output, it's most convenient to overview and comment with your colleagues.
Ruby on Rails Best Books
Do you want to learn ruby on rails? Well, you have come to the right place. Below are nine total books, categorized into Beginner, Intermediate, and advanced. All these books are focused on keeping you up with latest web development trends and happenings in ruby rails. If you are thinking of finding ruby on rails jobs, these books can be a good place to get started. Also, you can use the online ruby on rails videos to understand concept better. Education Ecosystem is a great place to start learning Ruby on Rails. Best wishes on becoming the future ruby on rails developer.
Using Rails, developers can build web applications of exceptional elegance and power. Although its remarkable capabilities have made Ruby on Rails one of the world’s most popular web development frameworks, it can be challenging to learn and use. Ruby on Rails™ Tutorial,
Ruby on Rails is the revolutionary online programming tool that makes creating functional e-commerce web sites faster and easier than ever. With the intuitive, straightforward nature of Ruby and the development platform provided by Rails, you can put together full-fledged web applications quickly, even if you're new to web programming.
by Sandi Metz
Ruby’s widely admired ease of use has a downside: Too many Ruby and Rails applications have been created without concern for their long-term maintenance or evolution. The Web is awash in Ruby code that is now virtually impossible to change or extend. This text helps you solve that problem by using powerful real-world object-oriented design techniques, which it thoroughly explains using simple and practical Ruby examples.
The word is out: with "Ruby on Rails" you can build powerful Web applications easily and quickly! And just like the Rails framework itself, Rails applications are Ruby programs. That means you can't tap into the full power of Rails unless you master the Ruby language.
by Mark Bates
Distributed programming techniques make applications easier to scale, develop, and deploy—especially in emerging cloud computing environments. Now, one of the Ruby community’s leading experts has written the first definitive guide to distributed programming with Ruby. Mark Bates begins with a simple distributed application, and then walks through an increasingly complex series of examples, demonstrating solutions to the most common distributed programming problems.
Rails is a robust, flexible development platform that lets you build complex websites quickly. Major websites like GitHub, Hulu, and Twitter have run Rails under the hood, and if you know just enough HTML and CSS to be dangerous,Rails Crash Course will teach you to harness Rails for your own projects and create web applications that are fast, stable, and secure.
Rails just keeps on changing. Both Rails 3 and 4, as well as Ruby 1.9 and 2.0, bring hundreds of improvements, including new APIs and substantial performance enhancements. The fourth edition of this award-winning classic has been reorganized and refocused so it's more useful than ever before for developers new to Ruby and Rails.
Learn Ruby the Hard Way: A Simple and Idiomatic Introduction to the Imaginative World Of Computational Thinking with Code
by Zed A. Shaw
Zed Shaw has perfected the world’s best system for learning Ruby. Follow it and you will succeed–just like the hundreds of thousands of beginners Zed has taught to date! You bring the discipline, commitment, and persistence; the author supplies everything else.
Ruby on Rails Projects (Reference)
Those who are avid travelers must be familiar with this company.
Airbnb allows its users to look for cheaper accommodation in the location they want to visit, set up the price range for their own property, the dates they want to rent it out and a whole range of quirks and instructions about the place.
What makes it different is that you will be renting a place from the locals instead of hotels or hostels.
From its conception until now, Airbnb has been counting on Rails as one of its back-end tools. Thanks to Rails, Airbnb managed to deal with a huge amount of daily transactions that have brought Airbnb to the company it is today.
Last year, Airbnb improved their large scale payments systems with Rails. As a result, they managed to have payment systems that have strong transactional integrity, a robust audit trail and very predictable failure behavior.
The success of Hulu is built on a simple concept: Provide Americans the ability to watch cable and network TV shows as well as movies legally and for free.
What makes Hulu different from its giant competitor, Netflix, is that Hulu gets its content faster – the tradeoff being Netflix has a broader range of content. So if you’re the type of person that needs to keep up with the latest shows, Hulu is the right choice.
After the RailsConf 2012, Matthew Butt, ex-Hulu development manager, explained how the ideals of Rails influenced greatly their software development.
“The ideals of Rails – convention over configuration, Don’t Repeat Yourself (whenever possible, reuse as much code as possible rather than duplicating similar code in multiple places), test first, and agile – are quickly becoming pervasive throughout software development,” he said. Because of Rails, Hulu has a large and attractive library of content, and is easy to navigate on a variety of platforms.
Even if you are not a programmer, you may have heard your geeky friends raving about Github.
Before diving into what Github is, you need to know first about Git, a version control system.
When software developers create an application, they make constant changes to the lines of code and release new versions, up to and after the first official release. The role of a version control system is to keep these changes (revisions) and store them in a central repository (storage). This way, developers can work together to make changes and upload the latest revision.
With Github, programmers can create a new project based off another existing project (forking), make revisions to the existing project so that they will be recognized by the original developers (pull request), and access changelogs so that they know who changed what.
As one of the 100 most popular sites in the world, Github is a large production Ruby on Rails application. It is because of Rails that Github can serve hundreds of millions of requests per day. Additionally, they also managed to upgrade their framework from Rails 2.3 into Rails 3 in 2014 with zero downtime.
Hackety Hack is an open source project designed to teach the basics of programming from the ground up via its website hackety.com.
Aside from learning Ruby programming language, users can also learn how to make an easy program based on Ruby. To help beginners create their first program, Hackety provides a stock of fun programs created by other Hackety users.
Have an idea for a new lesson or want to improve the existing lessons? As a contributor, there is a project on Github where you can help Hackety create new lessons, or update existing ones.
Decentralized, freedom and privacy are the three philosophies at the heart of this online social network.
Unlike sites like Facebook, Diaspora does not store its data in huge central servers. As a user, you can choose whichever local pod you want to be registered with.
Want the true freedom of speech where no one will track you down and shut you up? On Diaspora, you can be whoever you want without using your real identity. Plus, Diaspora doesn’t own your data. You don’t have to sign over any rights to a corporation or any party who could use it. Your content is your business.
Credit: Diaspora via Opensourcerails.com
You can contribute to this open source project on Github by squashing some bugs or contributing your own code.
Spree is an open source Rails eCommerce platform.
Spree boasts of itself as an eCommerce site that is flexible, customizable, easy to administer and easy to deploy. When it comes to software development, their rich features even top the enterprise edition of Magento, the world’s biggest eCommerce platform.
Other good news is that the backend of Spree is built upon simplicity, which means the options offered are not cluttered and overwhelming for developers.
With simplicity in mind, it’s going to be easier for developers to keep your products updated and current. This will influence the frontend and hence, improve the customer’s experience on the site.
Built on Rails, Spree is easy to develop, handles server requests faster, and takes fewer lines of code which speed up the website loading time. You can also contributeto making the software better on Github.
Ruby on Rails Community
Ruby on Rails is for everyone who wants to build web applications, whether they're 30-year veterans or only just started to learn yesterday. All are welcome!
You can meet the community online on the Ruby on Rails: Talk mailing list, the Ruby on Rails StackOverflow Q&A tag, or the #rubyonrails IRC channel on irc.freenode.net. We also do a yearly RailsConf conference for people to meet in real life.
Read more about Ruby on Rails Community here.
Ruby on Rails Gurus (Reference)
Ruby on Rails Conferences
- Garden City RubyConf
- Copenhagen Ruby Brigade
Vietnam Vietnam, Ho Chi Minh City
- Los Angeles Ruby Conference
United States, Burbank
South Africa, City of Cape Town
- Copenhagen Ruby Brigade