gem install rails --pre
rails new my_app -T
attachments: parent_id, asset_id | |
domain_names: organisation_id | |
event_memberships: user_id, event_id | |
events: editor_id | |
group_actions: user_id, group_id | |
groups: user_id | |
icons: parent_id | |
invitations: sender_id | |
legacy_actions: item_upon_id | |
news_items: author_id |
add_index :attachments, :parent_id | |
add_index :attachments, :asset_id | |
add_index :domain_names, :user_id | |
add_index :domain_names, :event_id | |
add_index :event_memberships, :user_id | |
add_index :event_memberships, :event_id | |
remove_index :attachments, :parent_id | |
remove_index :attachments, :asset_id | |
remove_index:domain_names, :user_id | |
remove_index:domain_names, :event_id |
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
module Player | |
describe MovieList, "with optional description" do | |
it "is pending example, so that you can write ones quickly" | |
it "is already working example that we want to suspend from failing temporarily" do | |
pending("working on another feature that temporarily breaks this one") |
class Test::Unit::TestCase # Or ActiveSupport::TestCase if you are using Rails | |
# This is a debugging utility to find slow tests. | |
# Usage: rake FIND_SLOW_TESTS=true test:units | |
unless ENV["FIND_SLOW_TESTS"].blank? | |
alias_method :old_run, :run | |
def run(*args, &block) | |
start_time = Time.now | |
old_run *args, &block | |
test_time = Time.now - start_time | |
puts "\nSLOW TEST: #{self.name}, #{test_time}s" if test_time > 0.5 |
#!/usr/bin/env ruby -w0 | |
# | |
# Using Pomodoro app by iUgol | |
# http://itunes.apple.com/en/app/pomodoro/id417574133?mt=12 | |
# | |
require "rubygems" | |
require "appscript" # gem install rb-appscript | |
include Appscript |
# autoload concerns | |
module YourApp | |
class Application < Rails::Application | |
config.autoload_paths += %W( | |
#{config.root}/app/controllers/concerns | |
#{config.root}/app/models/concerns | |
) | |
end | |
end |
This gist is no longer valid. Please see Compass-Rails for instructions on how to install.
#! /usr/bin/env ruby | |
# usage: | |
# $ das_download.rb email password [download_directory] | |
require 'mechanize' | |
# gem 'mechanize-progressbar' | |
email = ARGV[0] or raise('Please provide the email address for your account') | |
password = ARGV[1] or raise('Please provide the password for your account') | |
path = ARGV[2] || './' |
class PostsController < ActionController::Base | |
def create | |
Post.create(post_params) | |
end | |
def update | |
Post.find(params[:id]).update_attributes!(post_params) | |
end | |
private |