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
# encoding: UTF-8 | |
# Place in config/deploy.rb | |
# See: https://gist.github.com/joost/9343156 | |
# Adapted to work with rbenv | |
namespace :rails do | |
desc "Open the rails console on primary app server" | |
task :console do | |
on roles(:app), primary: true do | |
rails_env = fetch(:stage) | |
execute_interactively "#{bundle_cmd} #{current_path}/script/rails console #{rails_env}" |
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
# More robust version to update new or existing counter cache columns in your Rails app. | |
# See: https://gist.github.com/svyatov/4225663 | |
desc 'Update all cache counters' | |
task :update_cache_counters => :environment do | |
models_to_update = {} | |
# or: Rails.application.eager_load! | |
# Dir loads less, so it's faster | |
Dir.glob(Rails.root.join('app/models/**/*')).each { |model| require model if File.file?(model) } |