Sometimes, you are looking to permit all the parameters of your Rails model in controller strong parameters. Instead of specifying them explicitly, one by one, you can permit all of the model attributes. However, this is not a good practice for a production application. As the comment of the rails controller scaffold states as a reminder to: Never trust parameters from the scary internet, only allow the whitelist through.
This minipost will demonstrate how to update
rbenv version when you have installed it through
git to your system. To be more specific, we will update
rbenv from version 1.1.0 to version 1.1.1 via
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.
This minipost will guide you through on how to install the AWS cli and how to configure it in order to download your S3 assets locally. The setup is very simple and all the commands used are detailed and presented step-by-step.
This minipost will guide you on how to install a new version of bundler, how to bundle a rails application with a specific bundler version and how to update bundler on a project that is already bundled with another version.
This minipost will explain in detail the difference between the two finders
find_by(id: id). Both do the exact same thing when the record exists in the database. However, they handle differently the return values, when the record is not found in the database.
In this minipost you will be guided on how to connect to your DigitalOcean Droplet with SSH for the first time, how to change the droplet’s root password with a strong password and how to add your Public SSH key to the droplet to avoid password prompt on every SSH session.
How to create your first Ubuntu 18.10 x64 Digital Ocean droplet in Frankfurt for $5/month from the DigitalOcean Control Panel
In this minipost you will be guided to create your first Digital Ocean droplet with Ubuntu 18.10 x64 in Frankfurt region (or a region of your choice) from the DigitalOcean Control Panel, step by step with screenshots and with the minimum configuration required in order to access it and get started.
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.
Most of the times you want to develop using the edge version of rails. However, many times you need to generate an application with a specific version of rails. This minipost will guide you through on how to do that.
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
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:
clone which are very similar with two differences.
--version are command line switches that interact with the Ruby interpreter by instructing the output of Ruby version information. Although both can be used in the same way there is a small difference between them.
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.
There are three basic output methods in Ruby:
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.
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
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