Skip to content

Instantly share code, notes, and snippets.

View ratnikov's full-sized avatar

Dmitry Ratnikov ratnikov

  • wonder.com
  • New York, NY
View GitHub Profile
<VirtualHost *:80>
ServerName communitycollab.org <VirtualHost *:80>
ServerName communitycollab.org
DocumentRoot /var/www/bigmac/current/public
</VirtualHost>
<VirtualHost *:80>
ServerName newwebitects.webitects.com
# DocumentRoot /var/www/webitects/foo/public
DocumentRoot /var/www/webitects/current/public
Feature: Beer Donations
In order to donate a beer
A user
Should be signed_in
Background:
Given user@example.com is a user with password "secret"
Scenario: A registered user should be able to donate a beer to another registered user
Given someone@example.com is a user
$ gem bundle --backtrace
Calculating dependencies...
Updating source: http://gems.rubyforge.org
ERROR: While executing gem ... (ArgumentError)
comparison of Array with Array failed
c:/Ruby/lib/ruby/gems/1.8/gems/bundler-0.7.2/lib/bundler/resolver.rb:238
:in `sort_by'
c:/Ruby/lib/ruby/gems/1.8/gems/bundler-0.7.2/lib/bundler/resolver.rb:238
:in `search'
c:/Ruby/lib/ruby/gems/1.8/gems/bundler-0.7.2/lib/bundler/resolver.rb:109
$ rake repackage && rake install && gem bundle
(in c:/Documents and Settings/dfr/bundler)
rm -r pkg
mkdir -p pkg
WARNING: no rubyforge_project specified
WARNING: description and summary are identical
Successfully built RubyGem
Name: bundler
Version: 0.7.2
File: bundler-0.7.2.gem
class AccountsController < ApplicationController
def new
@account = Account.new
end
def create
@account = Account.new(params[:account])
if @account.save
session[:account_id] = @account.id
flash[:notice] = "Thank you for signing up! You are now logged in."
## I seem to have lost my base models - I had obtained them already from pre-existing tables.
Basically, this relates to one table, a model and a subclass, which I thought would be quite short.
class Person < ActiveRecord::Base
has_one :address
has_one :phone
belongs_to :district
def member?
mem # and if you really require true/false: !!mem
@ratnikov
ratnikov / gist:289926
Created January 29, 2010 17:31 — forked from rsl/gist:289924
context "#increment" do
setup { @object.create! }
evaluate { @object.increment! :attribute }
should_change("attribute", :from => 0, :to => 1) { @object.attribute }
end
1 class CreateSurveyResponseAlternatives < ActiveRecord::Migration
2 def self.up
3 create_table :survey_response_alternatives do |t|
4 t.string :name
5 t.string :value
6 t.integer :position
7 t.references :survey_item
8 end
9
10 #SurveyResponseAlternative.reset_column_information
class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
alias_method :originit, :initialize
def initialize(connection, logger, connection_parameters, config)
ret = originit(connection, logger, connection_parameters, config)
self.execute('SELECT prepare_perl_utils()')
return ret
end
end
class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
def initialize_with_perl_utils(*args)
returning(initialize_without_perl_utils(*args)) do
execute('SELECT prepare_perl_utils()')
end
end
alias_method_chain :initialize, :perl_utils
end