Set up continuous integration with GitHub action for ruby on rails application.

Continuous integration(CI) allowed you to test your code automatically whenever there is any commit towards the feature/main branch or any pull request comes in. This is great because sometimes you forgot to run tests cases locally before pushing the changes.

To set up GitHub Actions for our project we’ll need a workflow file. Workflows are made up of one or more jobs and can be scheduled or triggered by an event. The workflow can be used to build, test, package, release, or deploy a project on GitHub. You can read more about GitHub Actions here.

A simple way to encrypt values


MessageEncryptor is a simple way to encrypt values which get stored somewhere you don’t trust. The ciphertext and initialization vector are base64 encoded and returned to you. For more details, you can check out the official ruby doc here

Upgrading from Rails 4 to Rails 5 we also need to take care of ActiveSupport::MessageEncryptor. The behavior of the key is changed in Rails 5 and Ruby 2.4.2 and above.

For example, if you simply want to encrypt and decrypt the values in Rails 4 and ruby 2.2.0

Now in rails, 5 key should be 32 bytes only, so it…

Cross-site request with ‘SameSite=None’

Photo by Wes Hicks on Unsplash

What’s ‘SameSite'?

SameSite is the new recommended way to keep your website secure. It’d make CSRF even more secure. The SameSite attribute allows servers to assert that a cookie shouldn’t be sent along with cross-site requests. This change provides some protection against cross-site request-forgery attacks.

In simple terms, cookies that don’t include the SameSite=None and Secure labels won’t be accessible by third parties. This behaviour change was rolled out by Google on February 4, 2020.

Let’s understand the scenario in a Rails application. If your Rails application provides the API, which uses cookies for the authentication, then this new behaviour of cookies…

Docker on Mac can be a resource hog but it doesn’t have to be

Photo by Md Mahdi on Unsplash

If you’ve moved your development environment to Docker and you’re on a Mac, you might have noticed your web application stacks are slower than another native environment you’ve been used to. The fact of the matter is, Docker for Mac has terribly slow IO performance compared to on Linux machines.

Developing with docker under OSX/Windows is a huge pain, since sharing your code into containers slows down the code-execution. To solve the performance issue we can use docker-sync. To show how to set up the docker-sync with our application let’s take an example of a Rails application.

In my rails…

Rohit Lingayat

Ruby on Rails | React | AWS | Solr | JQuery

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store