Skip to content

Instantly share code, notes, and snippets.

View sovanlandy2's full-sized avatar

Sovanlandy sovanlandy2

  • 2359Media
  • Singapore
View GitHub Profile
@sovanlandy2
sovanlandy2 / gist:5f2e4b9bfd6410c6bdc7
Created September 25, 2014 06:09
RoR Validations
# Validate the length of the string
validates_length_of :username, :minimum => 5, :maximum => 255, :allow_blank => false
# or
validates :password, :length => { :minimum => 6 }, allow_blank: true
# Validate paperclip attachment
validates_attachment :profile_image,
@sovanlandy2
sovanlandy2 / set environment of app on heroku
Last active August 29, 2015 14:05
How to set heroku app environment to staging or production
heroku config:add RAKE_ENV=staging --remote staging
heroku config:add RAILS_ENV=staging --remote staging
# if you have parity gem installed:
staging config:add RAKE_ENV=staging
staging config:add RAILS_ENV=staging
# check out parity gem, designed specifically for heroku https://github.com/croaky/parity