Starts adding questions to polls
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
class Poll < ActiveRecord::Base
|
||||
has_many :booths
|
||||
has_many :voters, through: :booths, class_name: "Poll::Voter"
|
||||
has_many :questions
|
||||
|
||||
validates :name, presence: true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,6 +4,7 @@ class Poll::Question < ActiveRecord::Base
|
||||
acts_as_paranoid column: :hidden_at
|
||||
include ActsAsParanoidAliases
|
||||
|
||||
belongs_to :poll
|
||||
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
|
||||
|
||||
has_many :comments, as: :commentable
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
<%= @poll.name %>
|
||||
|
||||
<%= @poll.questions.sort_for_list.each do |question| %>
|
||||
<%= question.title %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user