增加一个说说数据库表

This commit is contained in:
tanhuazhe 2015-12-07 14:55:04 -06:00
parent 6fafc6a66f
commit 3674fe06cb
5 changed files with 36 additions and 1 deletions

2
app/models/word.rb Normal file
View File

@ -0,0 +1,2 @@
class Word < ActiveRecord::Base
end

View File

@ -0,0 +1,10 @@
class CreateWords < ActiveRecord::Migration
def change
create_table :words do |t|
t.string :name
t.text :description
t.timestamps null: false
end
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20151204094413) do
ActiveRecord::Schema.define(version: 20160103065324) do
create_table "article_comments", force: :cascade do |t|
t.datetime "created_at", null: false
@ -57,4 +57,11 @@ ActiveRecord::Schema.define(version: 20151204094413) do
add_index "users", ["email"], name: "index_users_on_email"
add_index "users", ["username"], name: "index_users_on_username"
create_table "words", force: :cascade do |t|
t.string "name"
t.text "description"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end

9
test/fixtures/words.yml vendored Normal file
View File

@ -0,0 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
description: MyText
two:
name: MyString
description: MyText

7
test/models/word_test.rb Normal file
View File

@ -0,0 +1,7 @@
require 'test_helper'
class WordTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end