Skip to content

Instantly share code, notes, and snippets.

class User < ActiveRecord::Base
set_table_name "externalusers"
has_and_belongs_to_many :projects
end
class Project < ActiveRecord::Base
has_and_belongs_to_many :users
end
create_table "externalusers", :force => true do |t|
t.string "login"
t.string "crypted_password"
t.string "password_salt"
t.string "persistence_token"
t.integer "login_count"
t.datetime "last_request_at"
t.datetime "last_login_at"
t.datetime "current_login_at"
t.string "last_login_ip"
$ script/console
Loading development environment (Rails 2.3.2)
>> User.find(7)
=> #<User id: 7, login: "testuser", crypted_password: "...", password_salt: "...", persistence_token: "...", login_count: 9, last_request_at: "2009-08-19 10:45:25", last_login_at: "2009-08-18 00:05:27", current_login_at: "2009-08-19 08:12:31", last_login_ip: "10.140.204.86", current_login_ip: "10.140.204.86", created_at: "2009-03-27 17:57:44", updated_at: "2009-08-19 10:45:25", customer_id: 1, perishable_token: "...", email: "address@email.com">
>> Project.find(1)
=> #<Project id: 1, customer_id: 1, name: "Test Project #1", created_at: "2009-08-19 04:04:04", updated_at: "2009-08-19 04:04:04">
>> User.find(7).projects
=> [#<Project id: 1, customer_id: 1, name: "Test Project #1", created_at: "2009-04-16 09:15:43", updated_at: "2009-04-16 09:15:48">]
>> Project.find(1).users
=> []
>> Asset.first.functions
Hirb Error: Mysql::Error: Unknown column 'services.asset_id' in 'where clause': SELECT `functions`.* FROM `functions` INNER JOIN `services` ON `functions`.id = `services`.function_id WHERE ((`services`.asset_id = 1)) ORDER BY name ASC
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:219:in `log'
vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:323:in `execute'
vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:608:in `select'
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
vendor/rails/activerecord/lib/active_record/base.rb:661:in `find_by_sql'
vendor/rails/activerecord/lib/active_record/base.rb:1548:in `find_every'
vendor/rails/activerecord/lib/active_record/base
class Asset < ActiveRecord::Base
has_many :service_assignments
has_many :services, :through => :service_assignments
has_many :functions, :through => :services
has_many :clusters, :through => :services
end
class ServiceAssignment < ActiveRecord::Base
belongs_to :asset
belongs_to :service
class CreateInterfaces < ActiveRecord::Migration
def self.up
create_table :interfaces do |t|
t.string :name
t.string :description
t.timestamps
end
end
def self.down
pool "myapp" do
cloud "app" do
using :ec2
instances 1..1
security_group do
authorize :from_port => 22, :to_port => 22
end
end
end
PoolParty core loadtime: 2.526893
provider_name = ec2
/Library/Ruby/Gems/1.8/gems/poolparty-1.6.9/bin/../lib/poolparty/cloud.rb:82:in `constantize': wrong number of arguments (1 for 0) (ArgumentError)
from /Library/Ruby/Gems/1.8/gems/poolparty-1.6.9/bin/../lib/poolparty/cloud.rb:82:in `using'
from ./clouds.rb:3
from /Library/Ruby/Gems/1.8/gems/poolparty-1.6.9/bin/../lib/poolparty/base.rb:13:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/poolparty-1.6.9/bin/../lib/poolparty/base.rb:13:in `initialize'
from /Library/Ruby/Gems/1.8/gems/poolparty-1.6.9/bin/../lib/poolparty/pool.rb:7:in `new'
from /Library/Ruby/Gems/1.8/gems/poolparty-1.6.9/bin/../lib/poolparty/pool.rb:7:in `cloud'
from ./clouds.rb:2
@threetee
threetee / nginx_unicorn.rb
Created June 15, 2011 22:03
chef nginx_unicorn recipe (part of modified application cookbook)
app = node.run_state[:current_app]
#unicorn
include_recipe "application::unicorn"
#nginx
include_recipe "nginx::source"
#nginx/unicorn proxy
socket = "/tmp/unicorn_#{app['id']}.sock"