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
#!/usr/bin/ruby | |
module Helpers | |
LINE = 80 | |
def announcing(msg) | |
print msg | |
yield | |
print "." * (LINE - msg.size - 6) | |
puts "\e[32m[DONE]\e[0m" | |
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
# Examples: | |
# | |
# Reprocess all versions of User#avatar | |
# rake carrierwave:reprocess class=User mounted_uploader=avatar | |
# | |
# Reprocess the versions: thumb, small, medium for User#avatar | |
# rake carrierwave:reprocess class=User mounted_uploader=avatar versions='thumb, small, medium' | |
namespace :carrierwave do | |
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
state_machine :state, :initial => :new do | |
before_transition any => :published do |project| | |
project.errors.add_to_base('bid cannot be empty') if project.bid.nil? | |
project.errors.add_to_base('domain must be verified') unless project.verified? | |
false unless project.errors.empty? | |
end | |
before_transition any => :paid do |project| | |
project.errors.add_to_base('domain must be verified') unless project.verified? | |
false unless project.errors.empty? |
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 Prescription < ActiveRecord::Base | |
belongs_to :doctor, :class_name => 'User', :foreign_key => 'doctor_id' | |
belongs_to :patient, :class_name => 'User', :foreign_key => 'patient_id' | |
belongs_to :pharmacist, :class_name => 'User', :foreign_key => 'pharmacist_id' | |
belongs_to :prescribable, :polymorphic => true | |
has_many :prescription_transactions | |
validates_presence_of :patient | |
validates_presence_of :uuid | |
# ... |
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
Prescription.generate | |
ActiveRecord::UnknownAttributeError: unknown attribute: doctor | |
from /Users/strike/projects/ohp/onehealthpass_core/vendor/rails/activerecord/lib/active_record/base.rb:2906:in `assign_attributes' | |
from /Users/strike/projects/ohp/onehealthpass_core/vendor/rails/activerecord/lib/active_record/base.rb:2902:in `each' | |
from /Users/strike/projects/ohp/onehealthpass_core/vendor/rails/activerecord/lib/active_record/base.rb:2902:in `assign_attributes' | |
from /Users/strike/projects/ohp/onehealthpass_core/vendor/rails/activerecord/lib/active_record/base.rb:2775:in `attributes=' | |
from /Users/strike/projects/ohp/onehealthpass_core/vendor/rails/activerecord/lib/active_record/base.rb:2473:in `initialize' | |
from /Users/strike/projects/ohp/onehealthpass_core/vendor/plugins/object_daddy/lib/object_daddy.rb:36:in `new' | |
from /Users/strike/projects/ohp/onehealthpass_core/vendor/plugins/object_daddy/lib/object_daddy.rb:36:in `spawn' | |
from /Users/strike/projects/ohp/onehealthpass_core/vendor/plugins/object_daddy |
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
require 'spec_helper' | |
def assign(*entities, &block) | |
entities = [entities].flatten.compact.uniq | |
entities.each { |e| yield(e) } | |
end | |
describe 'Visibility Rules' do | |
disconnect_sunspot |
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
require 'spec_helper' | |
def assign(*entities, &block) | |
entities = [entities].flatten.compact.uniq | |
entities.each { |e| yield(e) } | |
end | |
describe 'Visibility Rules' do | |
disconnect_sunspot |
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
generating encdb.h | |
encdb.h unchanged | |
making enc | |
make[1]: Nothing to be done for `enc'. | |
making srcs under enc | |
make[1]: Nothing to be done for `srcs'. | |
generating transdb.h | |
transdb.h unchanged | |
making trans | |
make[1]: Nothing to be done for `./enc/trans'. |
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
Colossus-2:miner strike$ rvm get head && rvm reload && rvm install 1.9.3 | |
Original installed RVM version: | |
rvm 1.6.18 by Wayne E. Seguin ([email protected]) [https://rvm.beginrescueend.com/] | |
Cloning into rvm... | |
remote: Counting objects: 5863, done. | |
remote: Compressing objects: 100% (2800/2800), done. | |
remote: Total 5863 (delta 3855), reused 4151 (delta 2309) |
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
rvm install 1.9.3 --patch remove-add_suffix.patch%0 | |
Installing Ruby from source to: /Users/strike/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)... | |
ruby-1.9.3-p0 - #fetching | |
ruby-1.9.3-p0 - #downloading ruby-1.9.3-p0, this may take a while depending on your connection... | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
100 9330k 100 9330k 0 0 237k 0 0:00:39 0:00:39 --:--:-- 266k | |
100 9330k 100 9330k 0 0 236k 0 0:00:39 0:00:39 --:--:-- 236kruby-1.9.3-p0 - #extracting ruby-1.9.3-p0 to /Users/strike/.rvm/src/ruby-1.9.3-p0 | |
ruby-1.9.3-p0 - #extracted to /Users/strike/.rvm/src/ruby-1.9.3-p0 |
OlderNewer