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.

Advertisements

How to check for empty brackets in a string?

Let's say we have a Movie model with "title" attribute and we would like to validate the title for empty brackets. For example: "Some text some text (some text) some text some text" #=> Valid title "Some text some text [some text] some text some text" #=> Valid title "Some text some text {some text} … Continue reading How to check for empty brackets in a string?

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?