解决冲突config/application.rb

This commit is contained in:
ccx1024cc 2016-12-11 11:01:55 +08:00
commit 3962970154
31 changed files with 329 additions and 6 deletions

8
.gitignore vendored
View File

@ -10,10 +10,16 @@
# Ignore the default SQLite database. # Ignore the default SQLite database.
/db/*.sqlite3 /db/*.sqlite3
/db/*.sqlite3-journal /db/*.sqlite3-journal
/db/schema.rb
# Ignore all logfiles and tempfiles. # Ignore all logfiles and tempfiles.
/log/* /log/*
!/log/.keep !/log/.keep
/tmp /tmp
*.swp *.swp
# Ignore IDEA files
.idea/*
# Ignore the files you install in your computer
Gemfile.lock

39
.rake_tasks~ Normal file
View File

@ -0,0 +1,39 @@
about
assets:clean[keep]
assets:clobber
assets:environment
assets:precompile
cache_digests:dependencies
cache_digests:nested_dependencies
db:create
db:drop
db:fixtures:load
db:migrate
db:migrate:status
db:rollback
db:schema:cache:clear
db:schema:cache:dump
db:schema:dump
db:schema:load
db:seed
db:setup
db:structure:dump
db:structure:load
db:version
doc:app
log:clear
middleware
notes
notes:custom
rails:template
rails:update
routes
secret
stats
test
test:all
test:all:db
test:db
time:zones:all
tmp:clear
tmp:create

3
app/models/comment.rb Normal file
View File

@ -0,0 +1,3 @@
class Comment < ActiveRecord::Base
belongs_to :mission
end

4
app/models/mission.rb Normal file
View File

@ -0,0 +1,4 @@
class Mission < ActiveRecord::Base
has_and_belongs_to_many :users
has_many :comments
end

3
app/models/note.rb Normal file
View File

@ -0,0 +1,3 @@
class Note < ActiveRecord::Base
belongs_to :user
end

3
app/models/project.rb Normal file
View File

@ -0,0 +1,3 @@
class Project < ActiveRecord::Base
has_and_belongs_to_many :users
end

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

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

6
app/models/user.rb Normal file
View File

@ -0,0 +1,6 @@
class User < ActiveRecord::Base
has_and_belongs_to_many :projects
has_and_belongs_to_many :missions
has_many :notes
end

View File

@ -12,10 +12,6 @@ module Workspace
# Application configuration should go into files in config/initializers # Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded. # -- all .rb files in that directory are automatically loaded.
# 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)'
# 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]
# config.i18n.default_locale = :de # config.i18n.default_locale = :de
@ -23,13 +19,17 @@ module Workspace
# Do not swallow errors in after_commit/after_rollback callbacks. # Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true config.active_record.raise_in_transactional_callbacks = true
# 设置时区为北京时间
config.time_zone = 'Beijing'
config.active_record.default_timezone = :local
config.generators do |g| config.generators do |g|
g.test_framework :rspec, g.test_framework :rspec,
fixtures: true, #为各模型生成测试固件 fixtures: true, #为各模型生成测试固件
view_specs: false, #不生成“视图测试” view_specs: false, #不生成“视图测试”
helper_specs: false, #生成控制器时不生成对应的帮助方法测试文件 helper_specs: false, #生成控制器时不生成对应的帮助方法测试文件
routing_specs: false, #不生成针对 config/routes.rb 的测试文件 routing_specs: false, #不生成针对 config/routes.rb 的测试文件
controller_specs: true, controller_specs: true, #自动生成controller测试
request_specs: false request_specs: false
g.fixture_replacement :factory_girl, dir: "spec/factories" g.fixture_replacement :factory_girl, dir: "spec/factories"
end end

View File

@ -0,0 +1,11 @@
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :name
t.string :password_digest
t.string :email
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,10 @@
class CreateProjects < ActiveRecord::Migration
def change
create_table :projects do |t|
t.string :name
t.string :content
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,12 @@
class CreateMissions < ActiveRecord::Migration
def change
create_table :missions do |t|
t.string :name
t.datetime :deadline
t.integer :priority
t.string :status
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,10 @@
class CreateComments < ActiveRecord::Migration
def change
create_table :comments do |t|
t.string :content
t.references :mission, index: true, foreign_key: true
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,9 @@
class CreateShares < ActiveRecord::Migration
def change
create_table :shares do |t|
t.string :content
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,10 @@
class CreateNotes < ActiveRecord::Migration
def change
create_table :notes do |t|
t.string :content
t.references :user, index: true, foreign_key: true
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,11 @@
class DropTablesNotNamedConventional < ActiveRecord::Migration
def change
drop_table :coment
drop_table :mission
drop_table :mission_coment
drop_table :note
drop_table :project
drop_table :share
drop_table :user
end
end

View File

@ -0,0 +1,5 @@
class RenameMissionUserToMissionsUsers < ActiveRecord::Migration
def change
rename_table :mission_user, :missions_users
end
end

View File

@ -0,0 +1,5 @@
class RenameProjectUserToProjectsUsers < ActiveRecord::Migration
def change
rename_table :project_user, :projects_users
end
end

74
db/schema.rb Normal file
View File

@ -0,0 +1,74 @@
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20161210055513) do
create_table "comments", force: :cascade do |t|
t.string "content"
t.integer "mission_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "comments", ["mission_id"], name: "index_comments_on_mission_id"
create_table "missions", force: :cascade do |t|
t.string "name"
t.datetime "deadline"
t.integer "priority"
t.string "status"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "missions_users", id: false, force: :cascade do |t|
t.integer "mission_id"
t.integer "user_id"
end
create_table "notes", force: :cascade do |t|
t.string "content"
t.integer "user_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "notes", ["user_id"], name: "index_notes_on_user_id"
create_table "projects", force: :cascade do |t|
t.string "name"
t.string "content"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "projects_users", id: false, force: :cascade do |t|
t.integer "project_id"
t.integer "user_id"
end
create_table "shares", force: :cascade do |t|
t.string "content"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "users", force: :cascade do |t|
t.string "name"
t.string "password_digest"
t.string "email"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end

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

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

13
test/fixtures/missions.yml vendored Normal file
View File

@ -0,0 +1,13 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
deadline: 2016-12-10 12:48:43
priority: 1
status: MyString
two:
name: MyString
deadline: 2016-12-10 12:48:43
priority: 1
status: MyString

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

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

9
test/fixtures/projects.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
content: MyString
two:
name: MyString
content: MyString

7
test/fixtures/shares.yml vendored Normal file
View File

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

11
test/fixtures/users.yml vendored Normal file
View File

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

View File

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

View File

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

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

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

View File

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

View File

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

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

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