$ rails g model User
belongs_to
has_one
psql postgres -c "create database circular_fkeys_left" | |
psql circular_fkeys_left <<EOS | |
create table foos(id integer primary key, bar_id integer); | |
create table bars(id integer primary key, foo_id integer); | |
insert into foos(id, bar_id) values(1, 5); | |
insert into bars(id, foo_id) values(5, 1); | |
alter table foos add constraint bar_fk foreign key(bar_id) references bars; | |
alter table bars add constraint foo_fk foreign key(foo_id) references foos; | |
EOS |
# initializers/devise.rb | |
config.omniauth :facebook, [APP_ID], [APP_SECRET] | |
config.omniauth :facebook_app1, [APP_ID], [APP_SECRET], :iframe => true, :scope => 'publish_stream,offline_access,email' | |
config.omniauth :facebook_app2, [APP_ID], [APP_SECRET], :iframe => true, :scope => 'publish_stream,offline_access,email' |
# define a method to run rake tasks | |
def run_rake(task, options={}, &block) | |
rake = fetch(:rake, 'rake') | |
rails_env = fetch(:rails_env, 'production') | |
command = "cd #{current_path} && #{rake} #{task} RAILS_ENV=#{rails_env}" | |
run(command, options, &block) | |
end | |
require 'rspec' | |
describe "Behaviour" do | |
it "should pass" do | |
true.should eq true | |
end | |
it "should fail" do | |
true.should eq false | |
end |
// clear canvas | |
canvas.clear(); | |
// add red rectangl | |
canvas.add(new fabric.Rect({ | |
width: 50, height: 50, left: 50, top: 50, fill: 'rgb(255,0,0)' | |
})); | |
canvas.add(new fabric.Rect({ | |
width: 50, height: 50, left: 110, top: 50, fill: 'rgb(255,0,0)' |
group :production do | |
gem 'unicorn' | |
# Enable gzip compression on heroku, but don't compress images. | |
gem 'heroku-deflater' | |
# Heroku injects it if it's not in there already | |
gem 'rails_12factor' | |
end |
require "spec_helper" | |
describe ExampleController do | |
context "GET #index" do | |
let(:resources) { FactoryGirl.create_list(:resource) } | |
before do | |
get :index | |
end |
module CapybaraWithPhantomJs | |
include Capybara | |
# Create a new PhantomJS session in Capybara | |
def new_session | |
# Register PhantomJS (aka poltergeist) as the driver to use | |
Capybara.register_driver :poltergeist do |app| | |
Capybara::Poltergeist::Driver.new(app) | |
end |