Skip to content

Instantly share code, notes, and snippets.

require 'validators'
class Call < ActiveRecord::Base
belongs_to :clear_unit, :class_name=>"Member"
belongs_to :call_dispatcher
belongs_to :category, :class_name=>"CallCategory"
has_many :patients
has_many :responses
has_many :recordings
#Here is the TableAcl model:
class TableAcl < ActiveRecord::Base
has_many :column_acls, :dependent => :destroy
....
#Here is the ColumnAcl model:
class ColumnAcl < ActiveRecord::Base
# Here is the Call model:
class Call < ActiveRecord::Base
include PimNormalizer
extend PimValidator
before_validation :normalize_state
belongs_to :clear_unit, :class_name=>"Member"
belongs_to :call_dispatcher
belongs_to :call_category
class Call < ActiveRecord::Base
# we need to override our date setters to ensure that we can accept the format provided
# by the forms
def time=(_time)
if _time.class == String
_time=DateTime.parse _time
end
p 'this is a test'
class Call < ActiveRecord::Base
before_destroy :check_associations
before_validation :normalize_state
before_save :normalize_times
belongs_to :clear_unit, :class_name=>"Member"
belongs_to :call_dispatcher
belongs_to :call_category
!= form_for visit, :html => { :method => :delete, :loading_trigger => true, :loading_target => 'add_visit' } do |form|
%fieldset
%h3
Delete Visit
%p
.form_field_error_messages
- errors = form.object.errors[:visit_date].join('; ')
- if ! errors.blank?
!= "Justification #{errors}. Please provide a reason for this modification."
!= label :comment, :comment, "Justification"
@dansteen
dansteen / gist:2c5037a40f3afe0f4e9b
Created December 11, 2014 16:23
syslog-ng config
source s_java{
file("/var/log/api/api_access.log" multi-line-mode(indented) program_override("java") flags(no-parse) tags("api_access.log") log-iw-size(2000) log-fetch-limit(1000));
file("/var/log/api/api_application.log" multi-line-mode(indented) program_override("java") flags(no-parse) tags("api_application.log") log-iw-size(2000) log-fetch-limit(1000));
};
destination d_java_redis { redis( command("LPUSH", "syslog", "${ISODATE} ${HOST}.stag.awse ${MSGHDR}${TAGS}: ${MSG}\n") host("redis_server_url") log-fifo-size(30000) ); };
log { source(s_java); destination(d_java_redis); };
@dansteen
dansteen / filter.conf
Last active August 29, 2015 14:13
patterns
filter {
if "java-api" in [type] {
multiline {
pattern => "^%{TIMESTAMP_ISO8601}"
negate => true
what => "previous"
}
grok {
match => [ "message", "%{API_APPLICATION_LOG}" ]
overwrite => [ "message", "severity" ]
@dansteen
dansteen / libraries_cloud_front_helper.rb
Created April 30, 2015 14:30
ruby inheritance in chef
module CustomDeploy
module CloudFrontHelper
...
def self.get_auth()
# put together our authentication
auth = {}
# # if we have set the access_key we add that in
auth = {
'AWS_ACCESS_KEY_ID' => node['traitify']['chef_testing_purposes']['aws_access_key_id'],
'AWS_SECRET_ACCESS_KEY' => node['traitify']['chef_testing_purposes']['aws_secret_access_key']
@dansteen
dansteen / gist:5ed3195e4762feeee6b8
Last active August 29, 2015 14:24
error output
NoMethodError
-------------
undefined method `[]' for nil:NilClass
Cookbook Trace:
---------------
/tmp/kitchen/cache/cookbooks/bob/recipes/dns.rb:52:in `block in from_file'
/tmp/kitchen/cache/cookbooks/bob/recipes/dns.rb:49:in `from_file'