From c9de30bd83b867bb80fa22ab769898ffb515db7f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 8 Jan 2015 12:00:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=97=AE=E5=8D=B7=E8=B0=83?= =?UTF-8?q?=E6=9F=A5=E7=9B=B8=E5=85=B3=E8=A1=A8=EF=BC=8C=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E7=9A=84model=E3=80=81control=E3=80=81view?= =?UTF-8?q?=E7=9A=84=E6=96=87=E4=BB=B6=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_answers_controller.rb | 0 app/controllers/poll_controller.rb | 0 app/controllers/poll_user_controller.rb | 0 app/controllers/poll_votes_controller.rb | 0 app/controllers/polls_questions_controller.rb | 0 app/models/poll_answers.rb | 3 +++ app/models/poll_questions.rb | 3 +++ app/models/poll_user.rb | 3 +++ app/models/poll_votes.rb | 3 +++ app/models/polls.rb | 3 +++ db/migrate/20150108034148_create_polls.rb | 15 +++++++++++++++ .../20150108034253_create_poll_questions.rb | 12 ++++++++++++ db/migrate/20150108034414_create_poll_answers.rb | 11 +++++++++++ db/migrate/20150108035301_create_poll_votes.rb | 12 ++++++++++++ db/migrate/20150108035338_create_poll_users.rb | 10 ++++++++++ test/unit/poll_answers_test.rb | 7 +++++++ test/unit/poll_questions_test.rb | 7 +++++++ test/unit/poll_user_test.rb | 7 +++++++ test/unit/poll_votes_test.rb | 7 +++++++ test/unit/polls_test.rb | 7 +++++++ 20 files changed, 110 insertions(+) create mode 100644 app/controllers/poll_answers_controller.rb create mode 100644 app/controllers/poll_controller.rb create mode 100644 app/controllers/poll_user_controller.rb create mode 100644 app/controllers/poll_votes_controller.rb create mode 100644 app/controllers/polls_questions_controller.rb create mode 100644 app/models/poll_answers.rb create mode 100644 app/models/poll_questions.rb create mode 100644 app/models/poll_user.rb create mode 100644 app/models/poll_votes.rb create mode 100644 app/models/polls.rb create mode 100644 db/migrate/20150108034148_create_polls.rb create mode 100644 db/migrate/20150108034253_create_poll_questions.rb create mode 100644 db/migrate/20150108034414_create_poll_answers.rb create mode 100644 db/migrate/20150108035301_create_poll_votes.rb create mode 100644 db/migrate/20150108035338_create_poll_users.rb create mode 100644 test/unit/poll_answers_test.rb create mode 100644 test/unit/poll_questions_test.rb create mode 100644 test/unit/poll_user_test.rb create mode 100644 test/unit/poll_votes_test.rb create mode 100644 test/unit/polls_test.rb diff --git a/app/controllers/poll_answers_controller.rb b/app/controllers/poll_answers_controller.rb new file mode 100644 index 000000000..e69de29bb diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb new file mode 100644 index 000000000..e69de29bb diff --git a/app/controllers/poll_user_controller.rb b/app/controllers/poll_user_controller.rb new file mode 100644 index 000000000..e69de29bb diff --git a/app/controllers/poll_votes_controller.rb b/app/controllers/poll_votes_controller.rb new file mode 100644 index 000000000..e69de29bb diff --git a/app/controllers/polls_questions_controller.rb b/app/controllers/polls_questions_controller.rb new file mode 100644 index 000000000..e69de29bb diff --git a/app/models/poll_answers.rb b/app/models/poll_answers.rb new file mode 100644 index 000000000..b400ddf50 --- /dev/null +++ b/app/models/poll_answers.rb @@ -0,0 +1,3 @@ +class PollAnswers < ActiveRecord::Base + attr_accessible :answer_position, :answer_text, :poll_questions_id +end diff --git a/app/models/poll_questions.rb b/app/models/poll_questions.rb new file mode 100644 index 000000000..42e376aee --- /dev/null +++ b/app/models/poll_questions.rb @@ -0,0 +1,3 @@ +class PollQuestions < ActiveRecord::Base + attr_accessible :is_necessary, :polls_id, :question_title, :question_type +end diff --git a/app/models/poll_user.rb b/app/models/poll_user.rb new file mode 100644 index 000000000..f77f2ed5c --- /dev/null +++ b/app/models/poll_user.rb @@ -0,0 +1,3 @@ +class PollUser < ActiveRecord::Base + attr_accessible :poll_id, :user_id +end diff --git a/app/models/poll_votes.rb b/app/models/poll_votes.rb new file mode 100644 index 000000000..961f0d896 --- /dev/null +++ b/app/models/poll_votes.rb @@ -0,0 +1,3 @@ +class PollVotes < ActiveRecord::Base + attr_accessible :poll_answers_id, :poll_questions_id, :user_id, :vote_text +end diff --git a/app/models/polls.rb b/app/models/polls.rb new file mode 100644 index 000000000..f37c89fe2 --- /dev/null +++ b/app/models/polls.rb @@ -0,0 +1,3 @@ +class Polls < ActiveRecord::Base + attr_accessible :closed_at, :polls_group_id, :polls_name, :polls_status, :polls_type, :published_at, :user_id +end diff --git a/db/migrate/20150108034148_create_polls.rb b/db/migrate/20150108034148_create_polls.rb new file mode 100644 index 000000000..e074e08be --- /dev/null +++ b/db/migrate/20150108034148_create_polls.rb @@ -0,0 +1,15 @@ +class CreatePolls < ActiveRecord::Migration + def change + create_table :polls do |t| + t.string :polls_name + t.string :polls_type + t.integer :polls_group_id + t.integer :polls_status + t.integer :user_id + t.datetime :published_at + t.datetime :closed_at + + t.timestamps + end + end +end diff --git a/db/migrate/20150108034253_create_poll_questions.rb b/db/migrate/20150108034253_create_poll_questions.rb new file mode 100644 index 000000000..8e795deda --- /dev/null +++ b/db/migrate/20150108034253_create_poll_questions.rb @@ -0,0 +1,12 @@ +class CreatePollQuestions < ActiveRecord::Migration + def change + create_table :poll_questions do |t| + t.string :question_title + t.integer :question_type + t.integer :is_necessary + t.integer :polls_id + + t.timestamps + end + end +end diff --git a/db/migrate/20150108034414_create_poll_answers.rb b/db/migrate/20150108034414_create_poll_answers.rb new file mode 100644 index 000000000..bc9ac6d9f --- /dev/null +++ b/db/migrate/20150108034414_create_poll_answers.rb @@ -0,0 +1,11 @@ +class CreatePollAnswers < ActiveRecord::Migration + def change + create_table :poll_answers do |t| + t.integer :poll_questions_id + t.text :answer_text + t.integer :answer_position + + t.timestamps + end + end +end diff --git a/db/migrate/20150108035301_create_poll_votes.rb b/db/migrate/20150108035301_create_poll_votes.rb new file mode 100644 index 000000000..e22228dc2 --- /dev/null +++ b/db/migrate/20150108035301_create_poll_votes.rb @@ -0,0 +1,12 @@ +class CreatePollVotes < ActiveRecord::Migration + def change + create_table :poll_votes do |t| + t.integer :user_id + t.integer :poll_questions_id + t.integer :poll_answers_id + t.text :vote_text + + t.timestamps + end + end +end diff --git a/db/migrate/20150108035338_create_poll_users.rb b/db/migrate/20150108035338_create_poll_users.rb new file mode 100644 index 000000000..158937ce0 --- /dev/null +++ b/db/migrate/20150108035338_create_poll_users.rb @@ -0,0 +1,10 @@ +class CreatePollUsers < ActiveRecord::Migration + def change + create_table :poll_users do |t| + t.integer :user_id + t.integer :poll_id + + t.timestamps + end + end +end diff --git a/test/unit/poll_answers_test.rb b/test/unit/poll_answers_test.rb new file mode 100644 index 000000000..ce8f558f4 --- /dev/null +++ b/test/unit/poll_answers_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PollAnswersTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/poll_questions_test.rb b/test/unit/poll_questions_test.rb new file mode 100644 index 000000000..bbe79ea40 --- /dev/null +++ b/test/unit/poll_questions_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PollQuestionsTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/poll_user_test.rb b/test/unit/poll_user_test.rb new file mode 100644 index 000000000..7dab4b63f --- /dev/null +++ b/test/unit/poll_user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PollUserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/poll_votes_test.rb b/test/unit/poll_votes_test.rb new file mode 100644 index 000000000..77ab9121e --- /dev/null +++ b/test/unit/poll_votes_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PollVotesTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/polls_test.rb b/test/unit/polls_test.rb new file mode 100644 index 000000000..5217817bb --- /dev/null +++ b/test/unit/polls_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PollsTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end