Software Development | Ruby on Rails
altered_beast Data Model

If you have a look at db/schema.rb you'll see there are 12 tables.

  • brain_busters
  • forums
  • moderatorships
  • monitorships
  • open_id_authentication_associations
  • open_id_authentication_nonces
  • open_id_authentication_settings
  • posts
  • schema_migrations
  • sites
  • topics
  • users

Some, but not all, of these tables correspond to Models. JawSpeak: First Steps in Rails, RESTful by Example, Part 1: Beast has a diagram of the model used in the original Beast. This is still fairly appropriate for altered_beast although it should now include a Site model.

Most of the tables are created by the auto_migrations plugin from the initial db/schema.rb file. These tables include:

  • forums
  • moderatorships
  • monitorships
  • posts
  • sites
  • topics
  • users

There are only three normal migrations:

  • 001_create_permalinks.rb
  • 002_add_brain_buster.rb
  • 20090317123901_add_open_id_authentication_tables.rb

The first of these adds permalinks to three already existing tables: Forum, Topics and Users. The second only adds the brain_busters table for the brain_buster plugin. The third migration adds the three open_id_authentication tables.

The relations between Model, Table and Migrations are given in the following table.

 

Model Table Table created by
  brain_busters migration 002
forum forums auto_migrations
moderatorship moderatorships auto_migrations
monitorship monitorships auto_migrations
monitorships_sweeper    
  open_id_authentication_associations migration 20090317123901
  open_id_authentication_nonces migration 20090317123901
  open_id_authentication_settings migration 20090317123901
post posts auto_migrations
posts_sweeper    
schema_migration schema_migrations  
site sites auto_migrations
topic topics auto_migrations
user_mailer    
user users auto_migrations