Skip to content

Instantly share code, notes, and snippets.

@messiahxu
messiahxu / user.rb
Created November 10, 2014 13:37
rails 4 user update_without_password
class User < ActiveRecord::Base
.....
# password section
has_secure_password
validates :password, length: { in: 6..30 }, if:->{password.present?}
.......
def update_without_password(params = {})
@messiahxu
messiahxu / gist:4538529
Created January 15, 2013 13:12
shell环境下不显示输入内容
#! /bin/bash
read -s content
echo $content