question builder
This commit is contained in:
parent
4356616566
commit
3105c8da5d
28 changed files with 338 additions and 15 deletions
14
app/models/question.rb
Normal file
14
app/models/question.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
class Question < ActiveRecord::Base
|
||||
attr_accessible :title, :global, :answers_attributes, :answer_ids, :question_type_id
|
||||
|
||||
belongs_to :question_type
|
||||
has_and_belongs_to_many :conferences
|
||||
|
||||
has_many :qanswers, :dependent => :delete_all
|
||||
has_many :answers, :through => :qanswers, :dependent => :delete_all
|
||||
|
||||
validates :title, :presence => true
|
||||
validates :answers, :presence => true
|
||||
|
||||
accepts_nested_attributes_for :answers, :allow_destroy => true
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue