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
# In Rails Controller | |
def playlist | |
@playlist = session[:playlist] = Playlist.new(current_user) | |
render :layout => false | |
end | |
# In RAILS view | |
xml.instruct! :xml, :version=>"1.0" | |
xml.playlist do | |
if @playlist.currently_playing? |
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
deploy.task :default do | |
deploy.web.disable | |
backup_db # custom task to backup database | |
deploy.migrations | |
deploy.web.enable | |
deploy.cleanup | |
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
#!/usr/bin/env ruby | |
require "fileutils" | |
@current_path = File.dirname(__FILE__) | |
def database_config(branch) | |
"#{current_path}/../database_configs/#{branch}.yml" | |
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 AuditHelper | |
def self.rebuild_from_audit(audit) | |
changes_in_order = Audit.find(:all, :conditions => ['auditable_id = ? AND auditable_type = ? AND version <= ?', audit.auditable_id, audit.auditable_type, audit.version], :order => "version") | |
current_attributes = {} | |
changes_in_order.each do |audit| | |
current_attributes.merge!(audit.changes || {}) | |
current_attributes.merge!(:version => audit.version) | |
end | |
obj = audit.auditable_type.constantize.new(current_attributes) |
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
audits = current_health.audits.find_all_by_created_at(day_helper.bae_of_day(day_of_month)) | |
# this is needed for production. Otherwise detect doesn't work | |
audits.collect(&:changes) | |
return false if audits.empty? | |
audits.detect { |a| !a.changes["weight"].nil? } |
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 Foo < ActiveRecord::Base | |
belongs_to :user | |
private | |
## | |
# Override callbacks to audit users | |
## | |
def audit_create_callback | |
audit_create(user) |
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
Server 'foo.elevatorup.com' as 'root' | |
'ruby' should be installed | |
'rails' should be installed | |
'git' version '1.6.1' should be installed | |
'php' version '5.x' should be installed | |
'php' version '4.x' should not be installed | |
Server 'bar.elevatorup.com' as 'root' | |
installed: | |
|'mysql' |'>=5.1'| |
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
### Here | |
aoeu | |
## here 2 | |
aoeu |
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
## spec "should stop the director" (line 49), this is all the setup code in order: | |
# from line 3 | |
@target = Example.new | |
# starting from line 8 | |
@director = mock | |
@runner = mock | |
@runner.stubs(:prepare) | |
@director.stubs(:go?).returns false |
OlderNewer