Ruby detective #1 – Singleton Class

I decided to challenge myself with a series of topic about Ruby. The first series is "method lookup". Let's look at an example class. Here I define a simple class Robot which has an instance method 'say_hello' and a class method 'droids' which finds all robots of type 'droid'. Obviously '.droids' method is not there … Continue reading Ruby detective #1 – Singleton Class

Advertisements

How to setup a Rails app with Sendgrid

In order to setup your Rails app with Sendgrid, this is the necessary configuration you need. Store username and password in environment variables. Create initializers/environment_variables.rb Create config/environment_variables.yml In config/environments/#{Rails.env}.rb In config/environment.rb Restart the server and you are good to go.

How to implement Rails params from the ground up in Ruby?

Hi guys! This time around I am going to show you how to implement Rails params completely from the ground up. As you probably already know, Rails has something called strong parameters. This is a security practice to prevent accidentally allowing users to update sensitive model attributes, for example "admin" flag in user model in … Continue reading How to implement Rails params from the ground up in Ruby?