Skip to content

Instantly share code, notes, and snippets.

View AtulKhanduri's full-sized avatar

Atul Khanduri AtulKhanduri

  • Noida
View GitHub Profile
@AtulKhanduri
AtulKhanduri / active_record_objects_autosave.md
Created April 25, 2018 07:06 — forked from demisx/active_record_objects_autosave.md
When Active Record Child Objects are Autosaved in Rails

belongs_to:

  1. Assigning an object to a belongs_to association does not automatically save the object. It does not save the associated object either.

has_one:

  1. When you assign an object to a has_one association, that object is automatically saved (in order to update its foreign key).
  2. In addition, any object being replaced is also automatically saved, because its foreign key will change too
  3. If either of these saves fails due to validation errors, then the assignment statement returns false and the assignment itself is cancelled.
  4. If the parent object (the one declaring the has_one association) is unsaved (that is, new_record? returns true) then the child objects are not saved. They will automatically when the parent object is saved.
@AtulKhanduri
AtulKhanduri / install-comodo-ssl-cert-for-nginx.rst
Created April 22, 2018 20:09 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@AtulKhanduri
AtulKhanduri / docker-commands.md
Last active November 23, 2017 19:23 — forked from AtulKsol/docker-commands.md
Docker commands

Container's IP Address

  • docker inspect CONTAINER-ID | grep IPAddress

Container IP address using docker-compose

  • docker-compose ip

Stop and remove all container

  • docker stop $(docker ps -a -q)
  • docker rm $(docker ps -a -q)