Skip to content

Instantly share code, notes, and snippets.

validate :custom_validation_method
def custom_validation_method
if parent_object.has_stuff? && name.blank?
errors.add :name, 'should not be blank when parent object has stuff'
end
end
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
config/database.yml
db/schema.rb
db/*.sqlite3
doc/app
doc/diagrams
log/*.log
tmp/*
#!/usr/bin/ruby -w
=begin
/***************************************************************************
* Copyright (C) 2008, Paul Lutus *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
http://localhost:4567/b71e6394-cb6a-4bf3-859f-d8b11fc86764/api
begin
require 'hanna/rdoctask'
rescue LoadError
require 'rake/rdoctask'
end
function getElementXPath(elt)
{
var path = "";
for (; elt && elt.nodeType == 1; elt = elt.parentNode)
{
idx = getElementIdx(elt);
xname = elt.tagName;
if (idx > 1) xname += "[" + idx + "]";
path = "/" + xname + path;
}
function getElementXPath(elt)
{
var path = "";
for (; elt && elt.nodeType == 1; elt = elt.parentNode)
{
idx = getElementIdx(elt);
xname = elt.tagName;
if (idx > 1) xname += "[" + idx + "]";
path = "/" + xname + path;
}
* keep people working on internal projects, assign and schedule the work
* dont look desperate, dont have immediate availability
* can tell a client you can 'shuffle internal projects' to accomodate them
* online ads dont work well
* referrals instead
* do a great job every single time
* voice calls important
* when people call you call them back
desc "List the gems that this rails application depends on"
task :gems => 'gems:base' do
Rails.configuration.gems.each do |gem|
print_gem_status(gem)
end
puts
puts "I = Installed"
puts "F = Frozen"
puts "R = Framework (loaded before rails starts)"
end