Skip to content

Instantly share code, notes, and snippets.

View rubyrider's full-sized avatar
🎯
Focusing

Irfan Ahmed rubyrider

🎯
Focusing
View GitHub Profile
# the day_statistics
include Mongoid::Document
field :date, type: Date
field :entity_id, type: Integer
field :todays_statistics, type: Hash
field :hotel_inventory, type: Hash
@rubyrider
rubyrider / deploy.rb
Created May 31, 2013 13:27
A very sample pattern of deployment file for capistrano
#For executing corn Jobs in server.
#set :whenever_command, "bundle exec whenever"
#require "whenever/capistrano"
require "delayed/recipes"
default_run_options[:pty] = true
set :ssh_options, {:forward_agent => true}
set :rails_env, "production"
def self.convert_key_to_human_readable_name(obj, options)
messages = []
class_name = obj.class.name.underscore
errors = obj.errors.messages
separator = options[:separator].present? ? options[:separator] : ','
errors.each do |key, value|
base_key = (options[key].present? && options.keys.include?(key)) ? options[key].to_s : key.to_s
values = value.each { |val| val.downcase }
values.flatten.join(" #{separator}") unless values.empty?
if key == :base