2014-03-26 11:09:39 +00:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: options
|
|
|
|
#
|
|
|
|
# id :integer not null, primary key
|
|
|
|
# option :string(255)
|
|
|
|
# poll_id :integer
|
|
|
|
# created_at :datetime
|
|
|
|
# updated_at :datetime
|
|
|
|
# votes :integer default(0), not null
|
|
|
|
#
|
|
|
|
|
2014-03-23 00:22:25 +00:00
|
|
|
class Option < ActiveRecord::Base
|
|
|
|
include Extra
|
|
|
|
|
2020-03-16 23:57:47 +00:00
|
|
|
#attr_protected :id, :updated_at, :created_at, :votes
|
2014-03-23 00:22:25 +00:00
|
|
|
|
|
|
|
validates_length_of :option, :in => 1..30
|
|
|
|
|
|
|
|
has_many :real_votes, :class_name => "Vote", :as => :votable
|
|
|
|
belongs_to :poll
|
|
|
|
|
|
|
|
def to_s
|
|
|
|
self.option
|
|
|
|
end
|
|
|
|
end
|