This file contains hidden or 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
worker_processes 3 # amount of unicorn workers to spin up | |
timeout 30 # restarts workers that hang for 30 seconds | |
preload_app true | |
GC.respond_to?(:copy_on_write_friendly=) and | |
GC.copy_on_write_friendly = true | |
before_fork do |server,worker| | |
defined?(ActiveRecord::Base) and |
This file contains hidden or 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
def json_for(target, options = {}) | |
options[:root] = false | |
options[:scope] ||= current_user | |
options[:url_options] ||= url_options | |
serializer = options.delete(:serializer) || target.active_model_serializer | |
serializer.new(target, options).to_json | |
end |
This file contains hidden or 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
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
This file contains hidden or 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 NotificationsWorker | |
include Sidekiq::Worker | |
sidekiq_options queue: :notification, retry: false | |
def perform(actor_id, user_ids, action, target_type, target_id) | |
actor = User.find(actor_id) | |
target = target_type.constantize.find(target_id) | |
notifications = [] | |
ActiveRecord::Base.transaction do |
This file contains hidden or 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
# A Basic API Controller for Rails | |
# Handles authentication via Headers, params, and HTTP Auth | |
# Automatically makes all requests JSON format | |
# | |
# Written for production code | |
# Made public for: http://broadcastingadam.com/2012/03/state_of_rails_apis | |
# | |
# Enjoy! | |
class ApiController < ApplicationController |
This file contains hidden or 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
require 'spec_helper' | |
describe ReviewsIndexQuery do | |
let(:user) { create(:user) } | |
let(:facility) { user.facility } | |
let(:p1) { create(:patient, | |
facility: facility, | |
mrn: '111', |
This file contains hidden or 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
def fetch_cases | |
cases = (admin? || csm?) ? Case : current_user.cases | |
cases = cases.order("#{sort_column} #{sort_direction}") | |
cases = cases.recent.pending_first.includes(:entries, :case_type, :user, :client) | |
cases = cases.page(page).per(per_page) | |
if search_term.present? | |
cases = cases.search_for(search_term) | |
end | |
cases |
This file contains hidden or 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 ReportsController < ApplicationController | |
before_filter :authenticate_csm! | |
def pending | |
#send_csv_data(PendingCasesReport.new.csv, 'pending_cases.csv') | |
setup_streaming_headers | |
self.response_body = streamer | |
end |
This file contains hidden or 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
require 'spec_helper' | |
require File.expand_path('../../../db/migrate/20130910173340_decrypt_case_identifiers', __FILE__) | |
describe 'Case identifiers decryption migration' do | |
subject(:migration) { DecryptCaseIdentifiers.new } | |
describe ".up" do | |
it "decrypts identifier of each case" do | |
cases = create_list(:case, 2) | |
cases[0].update_column(:identifier, encrypt('12345')) |
This file contains hidden or 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 FacebookCommentNotifer | |
def initialize(comment) | |
@comment = comment | |
end | |
def save | |
@comment.save && post_to_wall | |
end | |
private |