Skip to content

Commit

Permalink
- added type field to users, Reviewer < User model
Browse files Browse the repository at this point in the history
- added review fields to reports
  • Loading branch information
billymeltdown committed Oct 30, 2008
1 parent 41adc00 commit 8ca87e1
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/models/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Report < ActiveRecord::Base
belongs_to :location
belongs_to :reporter
belongs_to :polling_place
belongs_to :reviewer

has_many :report_tags, :dependent => :destroy
has_many :tags, :through => :report_tags
Expand Down
3 changes: 3 additions & 0 deletions app/models/reviewer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Reviewer < User
has_many :reports
end
2 changes: 1 addition & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ development:
database: votereport_development
username: root
password:
socket: /private/var/mysql/mysql.sock
socket: /tmp/mysql.sock

test:
adapter: mysql
Expand Down
12 changes: 12 additions & 0 deletions db/migrate/20081030012948_add_users_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class AddUsersType < ActiveRecord::Migration
def self.up
transaction do
add_column :users, :type, :string, :limit => 30
add_index :users, :type
end
end

def self.down
remove_column :users, :type
end
end
17 changes: 17 additions & 0 deletions db/migrate/20081030013549_add_report_review_attrs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class AddReportReviewAttrs < ActiveRecord::Migration
def self.up
# assigned_at, reviewed_at, reviewer_id
transaction do
add_column :reports, :assigned_at, :datetime
add_column :reports, :reviewed_at, :datetime
add_column :reports, :reviewer_id, :integer
add_index :reports, :reviewer_id
end
end

def self.down
remove_column :reports, :assigned_at
remove_column :reports, :reviewed_at
remove_column :reports, :reviewer_id
end
end
17 changes: 16 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20081023221200) do
ActiveRecord::Schema.define(:version => 20081030013549) do

create_table "filters", :options=>'ENGINE=MyISAM', :force => true do |t|
t.column "name", :string, :limit => 80
Expand Down Expand Up @@ -111,9 +111,22 @@
t.column "polling_place_id", :integer
t.column "created_at", :datetime
t.column "updated_at", :datetime
t.column "assigned_at", :datetime
t.column "reviewed_at", :datetime
t.column "reviewer_id", :integer
end

add_index "reports", ["created_at"], :name => "index_reports_on_created_at"
add_index "reports", ["reviewer_id"], :name => "index_reports_on_reviewer_id"

create_table "statistics", :options=>'ENGINE=MyISAM', :force => true do |t|
t.column "name", :string
t.column "created_at", :datetime
t.column "sort", :integer, :default => 0
t.column "string_value", :string
t.column "integer_value", :integer
t.column "decimal_value", :integer, :limit => 10
end

create_table "tags", :force => true do |t|
t.column "pattern", :string, :limit => 30
Expand All @@ -140,8 +153,10 @@
t.column "last_update_at", :datetime
t.column "created_at", :datetime
t.column "updated_at", :datetime
t.column "type", :string, :limit => 30
end

add_index "users", ["api_key"], :name => "index_users_on_api_key", :unique => true
add_index "users", ["type"], :name => "index_users_on_type"

end
8 changes: 8 additions & 0 deletions vendor/plugins/haml/init.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'rubygems'
begin
require File.join(File.dirname(__FILE__), 'lib', 'haml') # From here
rescue LoadError
require 'haml' # From gem
end

Haml.init_rails(binding)

0 comments on commit 8ca87e1

Please sign in to comment.