Skip to content

Commit

Permalink
date suggestion backing
Browse files Browse the repository at this point in the history
  • Loading branch information
mccolin committed Mar 25, 2012
1 parent b16fd4c commit a38fcb6
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/models/olympiad.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ class Olympiad < ActiveRecord::Base


is_sluggable :name, :slug_column=>:slug is_sluggable :name, :slug_column=>:slug


has_many :suggested_dates

end end
8 changes: 8 additions & 0 deletions app/models/suggested_date.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,8 @@
# WOSOMP
# SuggestedDate -- A date suggested for hosting an event

class SuggestedDate < ActiveRecord::Base

belongs_to :olympiad

end
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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. # 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. # 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 = '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. # 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] # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
Expand Down
27 changes: 27 additions & 0 deletions db/migrate/20120325221353_create_suggested_dates.rb
Original file line number Original file line Diff line number Diff line change
@@ -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
15 changes: 14 additions & 1 deletion db/schema.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # 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| create_table "olympiads", :force => true do |t|
t.string "name", :null => false t.string "name", :null => false
Expand Down Expand Up @@ -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", "created_at"], :name => "index_slugs_on_scope_and_slug_and_created_at"
add_index "slugs", ["scope", "slug"], :name => "index_slugs_on_scope_and_slug" 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| create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false t.string "encrypted_password", :default => "", :null => false
Expand Down
11 changes: 11 additions & 0 deletions test/fixtures/suggested_dates.yml
Original file line number Original file line Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions test/unit/suggested_date_test.rb
Original file line number Original file line Diff line number Diff line change
@@ -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.