Here some codes for Ruby rails