Miniposts

38 miniposts
Ruby

How to update your rbenv ruby version

When you install rbenv with git to your machine, it does not update automatically all the new available ruby versions. Therefore, you need to update by git pulling the latest stable release. This minipost will demonstrate step-by-step how to configure your rbenv with the latest stable release of Ruby.

Ruby on Rails

How to add Basic HTTP Authentication to a Ruby on Rails application

There is a certain stage in your application development process, where you need to prevent visitors from accessing the staging or the beta version of the app. To prevent unwanted access, a very basic HTTP authentication system should be added. Such a thing in Rails is extremely easy to add. This post is focused on authenticating access to all application parts.

Ruby on Rails

How to run multiple rails server instances on your local machine

Most of the times, you are developing more than one rails project at the same time and you want to avoid switching directories and start/stopping your development server. Running multiple rails server instances on your local machine is a daily essential. This minipost will demonstrate how to run multiple server instances using the -p option.

Ruby

What is the difference between clone and dup in Ruby

When you want to protect objects from being changed inside the methods you send them, Ruby offers some methods to preserve that original objects will not get altered in method calls. These methods are: dup and clone which are very similar with two differences.

Ruby

How to keep your irb session prompt and output shorter

While experimenting with code snippets on your irb (Interactive Ruby Interpreter) session, you might want to keep things clearer. This minipost demonstrates how to hide session returns and make irb prompt shorter allowing better focus on code execution.

Ruby

Different ways of printing in Ruby

There are three basic output methods in Ruby: print, puts and p. All these methods are used to output messages, results and valuable information during the execution of a Ruby program. However, there are some differences which are going to be demonstrated in this minipost.

Ruby

Avoid the use of unless conditional with an else clause in Ruby

In Ruby, there are three ways of negating conditions. The first one is the not keyword. The second one is with the negating ! (the bang operator of negation). The third and more natural sounding way of negating is the unless keyword. The keyword unless, express the exact same semantics as if not (expression) and if !(expression).

Ruby on Rails

Get rid of the gem documentation once & for all by specifying it on .gemrc

When installing a new gem using the gem install command, the documentation generation takes time and space on your development machine. This minipost, will demonstrate the common ways to avoid documentation installation when using gem install command. You could eliminate gem documentation, when you install new gems by adding flags to gem install command or add couple of settings to .gemrc file.