Ruby on Rails

Showing 10-18 of 26 results
EngineeringIcon ChevronTechnology

Clean Code and the Art of Exception Handling

By Ahmed AbdelHalim

Exceptions are as old as programming itself. An unhandled exception may cause unexpected behavior, and results can be spectacular. Over time, these errors have contributed to the impression that exceptions are bad. But exceptions are a fundamental element of modern programming. Rather than fearing exceptions, we should embrace them and learn how to benefit from them. In this article, we will discuss how to manage exceptions elegantly, and use them to write clean code that is more maintainable.

12 minute readContinue Reading
EngineeringIcon ChevronWeb Front-end

Grape Gem Tutorial: How To Build A REST-Like API In Ruby

By Botond Orban

In this tutorial, Toptal Engineer Orban Botond demonstrates how to use the Grape gem -- a REST-like API micro-framework for Ruby -- to build backend support in Rails for a JSON API. Grape is designed to run as a mountable rack engine that complements your web applications without interfering with them.

15 minute readContinue Reading
EngineeringIcon ChevronBack-end

Building a Color-based Image Search Engine in Ruby

By Nazar Hussain

With modern image editing tools, we often take for granted the ability to extract or identify color on some part of any image. However, doing it programmatically is not exactly so straightforward. Camalian, a Ruby gem, changes that, making extracting and manipulating colors in an image as easy as possible. In this article, Toptal engineer Nazar Hussain provides some insight into how various color spaces work, introduces Camalian, and gives an overview of how to use it to build a color-based image search engine in Ruby.

7 minute readContinue Reading
EngineeringIcon ChevronWeb Front-end

How to Use Rails Helpers: A Bootstrap Carousel Demonstration

By Carlos Ramirez III

One of the most misused, misunderstood, and neglected of all the Rails built-in structures is the view helper. Helpers often get a bad reputation for being a dumping ground for one-off methods used across the entire application's view layer. But what if your helpers could be more semantic, better organized, and even reusable across projects? What if they could be more than just one-off functions sprinkled throughout the view, but powerful methods that generated complex markup with ease leaving your views free of conditional logic and code? Let's see how to do this when building an image carousel, with the familiar Twitter Bootstrap framework and some good old-fashioned object-oriented programming.

7 minute readContinue Reading
EngineeringIcon ChevronWeb Front-end

Meet Volt, A Promising Ruby Framework For Dynamic Applications

By Amaury Andres Peniche Gonzalez

In an attempt to make web applications a lot more dynamic, front-end Javascript frameworks like Angular.js, Backbone.js and Ember.js have gained a lot of popularity. However, these frameworks often require a back-end application to be useful, so they are used in conjunction with web frameworks like Ruby on Rails and Django. On the other hand, Volt is capable of managing the back-end and a dynamic front-end; since both functionalities are tightly integrated into its core.

8 minute readContinue Reading
EngineeringIcon ChevronBack-end

Ruby Concurrency and Parallelism: A Practical Tutorial

By Eqbal Quran

A thorough and practical introduction to concurrent and parallel programming in Ruby, presenting and contrasting a number of techniques and options available, from the standpoints of both performance and complexity. Discusses forking, multithreading, the Global Interpreter Lock (GIL), and more.

10 minute readContinue Reading
EngineeringIcon ChevronWeb Front-end

The Publish-Subscribe Pattern on Rails: An Implementation Tutorial

By Ahmed AbdelHalim

The publish-subscribe pattern] (or pub/sub, for short) is a messaging pattern where senders of messages (publishers), do not program the messages to be sent directly to specific receivers (subscribers). Instead, the programmer "publishes" messages (events), without any knowledge of any subscribers there may be. This article provides insight in how to use the pub/sub pattern, in Rails, to communicate messages between different system components without these components knowing anything about each other's identity.

8 minute readContinue Reading
EngineeringIcon ChevronBack-end

A Guide to Rails Engines in the Wild: Real World Examples of Rails Engines in Action

By Joe James

Why are Rails Engines not used more often? I don't know the answer, but I do think that the generalization of "Everything is an Engine" has hidden the problem domains that they can help to solve.

12 minute readContinue Reading
EngineeringIcon ChevronWeb Front-end

The Many Interpreters and Runtimes of the Ruby Programming Language

By Ryan Wilcox

Which Ruby implementation is right for your project? While the reference implementation (Ruby MRI) remains the interpreter of choice, an alternate Ruby implementation may be right for your project, depending on your operational goals and constraints. This article showcases the Ruby interpreter implementations and runtimes available today, discussing the advantages and disadvantages of each.

9 minute readContinue Reading

Join the Toptal® community.