This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Setting < ActiveRecord::Base | |
validates_uniqueness_of :var | |
validates_presence_of :value | |
after_save :send_cron_later | |
#Setting.for(:display).set=(value) | |
def self.for(var) | |
find_or_create_by_var(var) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Custom field_error_proc | |
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
errors = Array(instance.error_message).join(', ') | |
if html_tag =~ /^<label/ | |
if html_tag !~ /^<label(?:\s+.*)*(\s+alt="(?:checkbox|hidden)")(?:\s+.*)*\s*/ | |
%(#{html_tag}).html_safe | |
else | |
%(#{html_tag}<span class="validation-error"> #{errors}</span>).html_safe | |
end | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'stackprof', require: false | |
gem 'ruby-prof', require: false |