Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
apprentice1988 committed Oct 24, 2015
1 parent 790f3d5 commit 063b287
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 1 deletion.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
Project for 1024 Hackathon

![ad](https://raw.githubusercontent.com/pathsource/hackathon/master/ad.jpg)

Hackathon Wuhan 2015 项目提交样例

#心途

##项目描述


##团队成员
* [apprentice1988](https://github.com/apprentice1988)
* [bydmm](https://github.com/bydmm)
* [xxseason](https://github.com/xxseason)
* [VincentZY](https://github.com/VincentZY)
* [Keyizhang](https://github.com/Keyizhang)

##产品预览
![image](https://raw.githubusercontent.com/binhe22/HackWuhan2015/master/pics/hackwuhan.png)
3 changes: 3 additions & 0 deletions app/models/comment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Comment < ActiveRecord::Base
belongs_to :project
end
1 change: 1 addition & 0 deletions app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class Project < ActiveRecord::Base

has_many :participations
has_one :puzzle
has_many :comments

def distance(coordinates)
coordinates ||= []
Expand Down
10 changes: 10 additions & 0 deletions db/migrate/20151024234751_create_comments.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateComments < ActiveRecord::Migration
def change
create_table :comments do |t|
t.text :content
t.belongs_to :project

t.timestamps null: false
end
end
end
9 changes: 8 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20151024154546) do
ActiveRecord::Schema.define(version: 20151024234751) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "comments", force: :cascade do |t|
t.text "content"
t.integer "project_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "participations", force: :cascade do |t|
t.integer "user_id"
t.integer "project_id"
Expand Down
9 changes: 9 additions & 0 deletions test/fixtures/comments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

one:
content: MyText
project_id: 1

two:
content: MyText
project_id: 1
7 changes: 7 additions & 0 deletions test/models/comment_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'test_helper'

class CommentTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

0 comments on commit 063b287

Please sign in to comment.