This is a little snippet I use:
date_of_last_fee_change = Fee.last_updated
To make it happen for all models:
ActiveRecord::Base.class_eval do def self.last_updated last = first(:order => 'updated_at DESC') last.try(:updated_at) end end
date_of_last_fee_change = Fee.last_updated
ActiveRecord::Base.class_eval do def self.last_updated last = first(:order => 'updated_at DESC') last.try(:updated_at) end end
#!/usr/bin/ruby
PATH = '/mnt/apps'
Dir.glob("#{PATH}/*").each do |dir|
Dir.chdir(dir)
puts "(in #{dir})"
ARGV.each { |cmd| system(cmd) }
end
./each-app.rb 'git pull' 'rake db:migrate'
chmod +x each-app.rb