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
# lib/tasks/deploy.rb | |
desc "deploy to heroku and notify hoptoad" | |
task :deploy => :environment do | |
puts "deploying to heroku..." | |
%x[git push heroku master] | |
puts "notifying hoptoad..." | |
rev = %x[git log master -n 1 --pretty=format:%H] | |
%x[rake hoptoad:deploy TO=production REVISION=#{rev}] | |
puts "done..." |
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
# Gemfile | |
source 'http://rubygems.org' | |
gem 'rails' | |
group :test do | |
gem 'capybara' | |
gem 'launchy' | |
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 filter_params(params) | |
params.inject({}) do |acc, (k, v)| | |
acc[k] = if v.is_a?(Hash) | |
filter_params(v) | |
else | |
v.is_a?(Tempfile) ? '[REMOVED: Tempfile]' : v | |
end | |
acc | |
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 Post < ActiveRecord::Base | |
include ActionView::Helpers::TextHelper # truncate | |
include ERB::Util # h | |
def to_s | |
truncate(h(user)) | |
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 Post < ActiveRecord::Base | |
def link_to_show_people_or_something | |
host = Rails.application.config.action_mailer.default_url_options[:host] | |
posts_url(:host => host) | |
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
# config/initializers/delayed_job_mongoid.rb | |
module Delayed | |
module Backend | |
module ActiveRecord | |
class Job < ::ActiveRecord::Base | |
def self.before_fork | |
::ActiveRecord::Base.clear_all_connections! | |
::Mongoid.master.connection.close | |
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
log/*.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
diff --git c/app/controllers/events_controller.rb w/app/controllers/events_controller.rb | |
index d7ce126..4e96ab9 100644 | |
--- c/app/controllers/events_controller.rb | |
+++ w/app/controllers/events_controller.rb | |
@@ -17,4 +17,8 @@ class EventsController < TdsController | |
end | |
end | |
+ def show | |
+ @event = Event.find_by_slug! params[:id] |
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
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
sendfile on; |
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
# instead of this: | |
assert_emails do | |
post :create, :invitation => Invitation.plan | |
end | |
# ...do this: | |
assert_difference 'ActionMailer::Base.deliveries.size' do | |
post :create, :invitation => Invitation.plan | |
end |