星期四, 2月 22, 2007

DB Schema for acts_as_taggable_on_steroids


class AddTagSupport < force =""> true do t
t.column :name, :string
end

create_table :taggings, :force => true do t
t.column :tag_id, :integer
t.column :taggable_id, :integer
t.column :taggable_type, :string
t.column :created_at, :datetime
end

create_table :products_tags, :id => false, :force => true do t
t.column :tag_id, :integer, :default => "0", :null => false
t.column :product_id, :integer, :default => 0, :null => false
end

# Index your tags/taggings
add_index :tags, :name
add_index :taggings, [:tag_id, :taggable_id, :taggable_type]
end

def self.down
drop_table "tags"
drop_table "taggings"
drop_table "products_tags
end

end


You really only need the first two tables to have it up and working.

Ruby Unit Testing

James Edward Gray shows how to apply unit tests to solving Ruby Quiz #84: Generating Pascal’s Triangle. In the process he also demonstrates a lot of features from the Ruby bundle and explains conventions and rationale behind them.

The Ruby Quiz screencast (42 MB) is almost an hour long, so you may want to grab a snack before you start it :)

sd.rb screencast

This is a a very good site from san diego ruby users group - http://podcast.sdruby.com/

Episodes includes

  • ActsAsTaggable Plugin
  • REST with Rails
  • Rails Authentication
  • Rails Deployment

Enjoy!