Apr 13th2011

Schemata is a gem for corralling schema definitions across projects. As we work on new projects a lot of common field requirements come up ( addressess, contact forms, medical forms ) but its rare that the field names are ever implemented the same. Its a minor issue, but a major pet peeve of mine is when 'email_address' is defined as 'email' or 'phone_number' defined as 'phone' (Don't get me started on street_address_1 and all of its relatives ). 

So with schemata you define the fields once and then they are available to use in your migration files.  

gem 'schemata'

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# addressable.rb
module Schemata
  module Schema
      def addressable
        apply_schema :street_address_1, String
        apply_schema :street_address_2, String
        apply_schema :city, String
        apply_schema :state, String
        apply_schema :zip_code, String
        apply_schema :country, String
      end
    
    end
end

#provides your migration file with
create_table :accounts do |t|
    t.addressable
end

# instead of The Old Way
create_table :accounts do |t|
    t.string "street_address_1"
    t.string "street_address_2"
    t.string "city"
    t.string "state"
    t.string "zip_code"
    t.string "country"
end

 

Permalink | Leave a comment  »

Feb 10th2011

I came across the most amazing tool today: gource. It analyzes git logs and creates a time-lapse of commits -- which is pretty sexy once you throw in gravatars and directory names. Check out how we worked like busy little bees on a couple of our latest projects. 

missouriwine.org

tlg8gear.com

Permalink | Leave a comment  »

Coming Soon



Slipmate