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 String | |
def articleize | |
%w(a e i o u).include?(self[0].downcase) ? "an #{self}" : "a #{self}" | |
end | |
end |
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 Hospital < ActiveRecord::Base | |
has_many :user_assignments, :dependent => :destroy | |
has_many :users, :through => :user_assignments | |
# 30 hospitals | |
# There are 36 columns in this table, so we want to use .select() to limit which ones are pulled by the query | |
end |
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 DocumentUploader < CarrierWave::Uploader::Base | |
include CarrierWave::RMagick | |
# Store on Amazon S3 using Fog | |
storage :fog | |
# Directory where uploaded files will be stored. | |
def store_dir | |
"documents/#{model.id}" | |
end |