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/env ruby | |
File.open("/data/my_app/shared/pids/my_app_job_runner.pid", "w") do |f| | |
f << Process.pid.to_s | |
end | |
`cd /data/my_app/current;/usr/bin/env HOME=/home/deploy RAILS_ENV=production rake jobs:work& > log/delayed_jobs.log` |
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/spec_helper" | |
class Bad | |
def self.deliver_message | |
raise "It broke." | |
end | |
end | |
class BadJob | |
def perform |
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
module Delayed | |
class Worker | |
alias_method :original_handle_failed_job, :handle_failed_job | |
protected | |
def handle_failed_job(job, error) | |
say "Error Intercepted by Hoptoad..." | |
HoptoadNotifier.notify(error) | |
original_handle_failed_job(job,error) | |
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
gem install prologue | |
prologue new my_awesome_app |
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
def index | |
render :json => @users | |
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
def as_json(options={}) | |
super(:only => [:first_name,:last_name,:city,:state], | |
:include => { | |
:employers => {:only => [:title]}, | |
:roles => {:only => [:name]} | |
} | |
) | |
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
[{ | |
"user": { | |
"roles": [{ | |
"name": "Admin" | |
}], | |
"city": "Boulder", | |
"last_name": "Schaafsma", | |
"employers": [{ | |
"title": "Quick Left" | |
}], |
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
def full_name | |
"#{first_name} #{last_name}" | |
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
def as_json(options={}) | |
super(:only => [:city,:state], | |
:methods => [:full_name], | |
:include => { | |
:employers => {:only => [:title]}, | |
:roles => {:only => [:name]} | |
} | |
) | |
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
[{ | |
"user": { | |
"roles": [{ | |
"name": "Admin" | |
}], | |
"city": "Boulder", | |
"employers": [{ | |
"title": "Quick Left" | |
}], | |
"state": "CO", |
OlderNewer