增加问卷调查相关表,以及对应的model、control、view的文件夹

This commit is contained in:
sw 2015-01-08 12:00:43 +08:00
parent da85c3efb8
commit c9de30bd83
20 changed files with 110 additions and 0 deletions

View File

View File

View File

View File

@ -0,0 +1,3 @@
class PollAnswers < ActiveRecord::Base
attr_accessible :answer_position, :answer_text, :poll_questions_id
end

View File

@ -0,0 +1,3 @@
class PollQuestions < ActiveRecord::Base
attr_accessible :is_necessary, :polls_id, :question_title, :question_type
end

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

@ -0,0 +1,3 @@
class PollUser < ActiveRecord::Base
attr_accessible :poll_id, :user_id
end

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

@ -0,0 +1,3 @@
class PollVotes < ActiveRecord::Base
attr_accessible :poll_answers_id, :poll_questions_id, :user_id, :vote_text
end

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

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

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

View File

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

View File

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

View File

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

7
test/unit/polls_test.rb Normal file
View File

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