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 AmazonSimplePayTransaction < ActiveRecord::Base | |
after_create :pay_amazon_simple_payable | |
belongs_to :amazon_simple_payable, :polymorphic => true | |
private | |
def pay_amazon_simple_payable | |
amazon_simple_payable.update_attributes! :paid => true if %w{PI PS}.include?(status) | |
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 Customer < ActiveRecord::Base | |
def self.connect_each(&block) | |
all.each do |customer| | |
ActiveRecord::Base.establish_connection customer.database | |
yield customer | |
end | |
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
Customer.connect_each do |customer| | |
puts "Customer #{customer.name} has #{User.count} 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 self.connect_each(&block) | |
ordered.each do |customer| | |
ActiveRecord::Base.establish_connection customer.environment | |
begin | |
next unless ActiveRecord::Base.connection.active? | |
yield customer | |
rescue | |
next | |
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
#Images | |
.image | |
+lightly-tinted | |
:padding 8px | |
:float left | |
:margin-right 15px | |
:text-align center | |
:width = !content_width / 3 - 35 | |
a | |
:display block |
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
<ul id="navlist"> | |
<li>One</li> | |
<li>Two</li> | |
</ul> |
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
<% form_tag search_path, :method => :get do %> | |
<%= text_field_tag "query", nil, :class => "text" %> | |
<%= submit_tag "search", :name => nil %> | |
<% 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
<% form_tag search_path, :method => :get, :id => "search" do %> | |
<%= text_field_tag "query", nil %> | |
<%= image_submit_tag "http://s3.amazonaws.com/dfc_attachments/images/3708/go.gif", :name => nil, :class => "go" %> | |
<% 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
--- dso_development_directories.sql | |
+++ (clipboard) | |
@@ -12,101 +12,15 @@ | |
`full_path` varchar(250) default NULL, | |
PRIMARY KEY (`id`), | |
KEY `fk_d_parish` (`parish_id`) | |
-) ENGINE=InnoDB AUTO_INCREMENT=196 DEFAULT CHARSET=latin1; | |
+) ENGINE=InnoDB AUTO_INCREMENT=197 DEFAULT CHARSET=latin1; | |
insert into `directories` values('1',null,'',null,'0','/'), |
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
desc "Migrate all of the databases" | |
task :migrate_all => :environment do | |
Customer.connect_each do |customer| | |
puts "Migrating #{customer.environment}" | |
ActiveRecord::Migrator.migrate "db/migrate/" | |
end | |
end |