ensl.org/app/models/option.rb
Ari Timonen e59e8ac8e7 Lots of rails 4 updates
- Add .params to models and update controllers
- Add afk time to gather
- Reannotate models
- Fix rspec problem by using latest rspec plugins from github
2020-03-18 05:38:17 +02:00

35 lines
712 B
Ruby

# == Schema Information
#
# Table name: options
#
# id :integer not null, primary key
# option :string(255)
# votes :integer default("0"), not null
# created_at :datetime
# updated_at :datetime
# poll_id :integer
#
# Indexes
#
# index_options_on_poll_id (poll_id)
#
class Option < ActiveRecord::Base
include Extra
#attr_protected :id, :updated_at, :created_at, :votes
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
def self.params(params, cuser)
# FIXME: check this
params.require(:option).permit(:option, :votes, :poll_id)
end
end