Skip to content

Commit

Permalink
Adding the Annotate gem to add schema information to the top of each …
Browse files Browse the repository at this point in the history
…model

  - rake task
  - comments added to models, will need to be updated with each schema change

added annotate gem and rake task

left out annotate.rake from last check in
  • Loading branch information
boscomonkey authored and baccigalupi committed Apr 25, 2012
1 parent e61a911 commit 7dff557
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ group :test do
end

group :test, :development do
gem 'annotate', '~> 2.4.1.beta'
gem 'rspec-rails'
end

2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ GEM
activesupport (3.1.3)
multi_json (~> 1.0)
addressable (2.2.6)
annotate (2.4.1.beta1)
arel (2.2.1)
bcrypt-ruby (3.0.1)
builder (3.0.0)
Expand Down Expand Up @@ -165,6 +166,7 @@ PLATFORMS
ruby

DEPENDENCIES
annotate (~> 2.4.1.beta)
capybara
coffee-rails (~> 3.1.1)
database_cleaner
Expand Down
13 changes: 13 additions & 0 deletions app/models/event.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# == Schema Information
# Schema version: 20120410060636
#
# Table name: events
#
# id :integer not null, primary key
# title :string(255)
# created_at :datetime
# updated_at :datetime
# date :datetime
# location_id :integer
#

class Event < ActiveRecord::Base
belongs_to :location
has_many :volunteerRsvps
Expand Down
12 changes: 12 additions & 0 deletions app/models/location.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# == Schema Information
# Schema version: 20120410060636
#
# Table name: locations
#
# id :integer not null, primary key
# name :string(255)
# address :text
# created_at :datetime
# updated_at :datetime
#

class Location < ActiveRecord::Base
has_many :events
end
48 changes: 48 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
# == Schema Information
# Schema version: 20120410060636
#
# Table name: users
#
# id :integer not null, primary key
# email :string(255) default(""), not null
# encrypted_password :string(128) default(""), not null
# reset_password_token :string(255)
# reset_password_sent_at :datetime
# remember_created_at :datetime
# sign_in_count :integer default(0)
# current_sign_in_at :datetime
# last_sign_in_at :datetime
# current_sign_in_ip :string(255)
# last_sign_in_ip :string(255)
# confirmation_token :string(255)
# confirmed_at :datetime
# confirmation_sent_at :datetime
# failed_attempts :integer default(0)
# unlock_token :string(255)
# locked_at :datetime
# authentication_token :string(255)
# created_at :datetime
# updated_at :datetime
# teaching :boolean
# taing :boolean
# coordinating :boolean
# childcaring :boolean
# writing :boolean
# hacking :boolean
# designing :boolean
# evangelizing :boolean
# mentoring :boolean
# macosx :boolean
# windows :boolean
# linux :boolean
# other :string(255)
# name :string(255)
#
# Indexes
#
# index_users_on_unlock_token (unlock_token) UNIQUE
# index_users_on_confirmation_token (confirmation_token) UNIQUE
# index_users_on_reset_password_token (reset_password_token) UNIQUE
# index_users_on_email (email) UNIQUE
#

class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
Expand Down
13 changes: 13 additions & 0 deletions app/models/volunteer_rsvp.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# == Schema Information
# Schema version: 20120410060636
#
# Table name: volunteer_rsvps
#
# id :integer not null, primary key
# user_id :integer
# event_id :integer
# attending :boolean
# created_at :datetime
# updated_at :datetime
#

class VolunteerRsvp < ActiveRecord::Base
belongs_to :user
belongs_to :event
Expand Down
6 changes: 6 additions & 0 deletions lib/tasks/annotate.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace :annotate do
desc "Generate model annotation"
task :generate do
`annotate --position before --show-migration --show-indexes --exclude tests --exclude fixtures`
end
end

0 comments on commit 7dff557

Please sign in to comment.