Skip to content
This repository was archived by the owner on May 17, 2022. It is now read-only.

Commit 06cd794

Browse files
committed
Adds proposals scores
1 parent 6840271 commit 06cd794

File tree

5 files changed

+49
-1
lines changed

5 files changed

+49
-1
lines changed

app/models/proposal_score.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class ProposalScore < ActiveRecord::Base
2+
belongs_to :user
3+
belongs_to :proposal
4+
end
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class CreateProposalScores < ActiveRecord::Migration
2+
def change
3+
create_table :proposal_scores do |t|
4+
t.references :user, index: true
5+
t.references :proposal, index: true
6+
t.boolean :read, default: false
7+
t.boolean :favorite, default: false
8+
9+
t.timestamps
10+
end
11+
end
12+
end

db/schema.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
# It's strongly recommended that you check this file into your version control system.
1313

14-
ActiveRecord::Schema.define(version: 20140327154651) do
14+
ActiveRecord::Schema.define(version: 20140327160940) do
1515

1616
create_table "comments", force: true do |t|
1717
t.integer "user_id"
@@ -24,6 +24,18 @@
2424
add_index "comments", ["proposal_id"], name: "index_comments_on_proposal_id", using: :btree
2525
add_index "comments", ["user_id"], name: "index_comments_on_user_id", using: :btree
2626

27+
create_table "proposal_scores", force: true do |t|
28+
t.integer "user_id"
29+
t.integer "proposal_id"
30+
t.boolean "read", default: false
31+
t.boolean "favorite", default: false
32+
t.datetime "created_at"
33+
t.datetime "updated_at"
34+
end
35+
36+
add_index "proposal_scores", ["proposal_id"], name: "index_proposal_scores_on_proposal_id", using: :btree
37+
add_index "proposal_scores", ["user_id"], name: "index_proposal_scores_on_user_id", using: :btree
38+
2739
create_table "proposals", force: true do |t|
2840
t.string "name"
2941
t.string "email"

test/fixtures/proposal_scores.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2+
3+
one:
4+
user_id:
5+
proposal_id:
6+
read: false
7+
favorite: false
8+
9+
two:
10+
user_id:
11+
proposal_id:
12+
read: false
13+
favorite: false

test/models/proposal_score_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require 'test_helper'
2+
3+
class ProposalScoreTest < ActiveSupport::TestCase
4+
# test "the truth" do
5+
# assert true
6+
# end
7+
end

0 commit comments

Comments
 (0)