Permalink
Browse files

date suggestion backing

  • Loading branch information...
1 parent b16fd4c commit a38fcb6a415f0468c89e9b7b9d5753faa841c492 @mccolin committed Mar 25, 2012
View
@@ -5,4 +5,6 @@ class Olympiad < ActiveRecord::Base
is_sluggable :name, :slug_column=>:slug
+ has_many :suggested_dates
+
end
@@ -0,0 +1,8 @@
+# WOSOMP
+# SuggestedDate -- A date suggested for hosting an event
+
+class SuggestedDate < ActiveRecord::Base
+
+ belongs_to :olympiad
+
+end
View
@@ -28,6 +28,8 @@ class Application < Rails::Application
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
+ config.time_zone = "Eastern Time (US & Canada)"
+ config.active_record.default_timezone = :local
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
@@ -0,0 +1,27 @@
+# WOSoMP
+#
+
+class CreateSuggestedDates < ActiveRecord::Migration
+ def change
+ create_table :suggested_dates do |t|
+ # Link a suggestion to an Olympiad:
+ t.integer :olympiad_id, :null=>false
+
+ # Give it parameters:
+ t.datetime :begins_at
+ t.datetime :ends_at
+
+ # Cache a total vote score:
+ t.integer :score, :default=>0
+
+ # And details:
+ t.string :location_name
+ t.text :notes
+
+ # Bookkeeping:
+ t.timestamps
+ end
+
+ add_index :suggested_dates, :olympiad_id
+ end
+end
View
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120325205046) do
+ActiveRecord::Schema.define(:version => 20120325221353) do
create_table "olympiads", :force => true do |t|
t.string "name", :null => false
@@ -50,6 +50,19 @@
add_index "slugs", ["scope", "slug", "created_at"], :name => "index_slugs_on_scope_and_slug_and_created_at"
add_index "slugs", ["scope", "slug"], :name => "index_slugs_on_scope_and_slug"
+ create_table "suggested_dates", :force => true do |t|
+ t.integer "olympiad_id", :null => false
+ t.datetime "begins_at"
+ t.datetime "ends_at"
+ t.integer "score", :default => 0
+ t.string "location_name"
+ t.text "notes"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "suggested_dates", ["olympiad_id"], :name => "index_suggested_dates_on_olympiad_id"
+
create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+# This model initially had no columns defined. If you add columns to the
+# model remove the '{}' from the fixture names and add the columns immediately
+# below each fixture, per the syntax in the comments below
+#
+one: {}
+# column: value
+#
+two: {}
+# column: value
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class SuggestedDateTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end

0 comments on commit a38fcb6

Please sign in to comment.