Class: Effective::PollQuestion

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/effective/poll_question.rb

Constant Summary collapse

CATEGORIES =
[
  'Choose one',   # Radios
  'Select all that apply', # Checks
  'Select upto 1',
  'Select upto 2',
  'Select upto 3',
  'Select upto 4',
  'Select upto 5',
  'Date',         # Date Field
  'Email',        # Email Field
  'Number',       # Numeric Field
  'Long Answer',  # Text Area
  'Short Answer', # Text Field
  'Upload File'   # File field
]
WITH_OPTIONS_CATEGORIES =
[
  'Choose one',   # Radios
  'Select all that apply', # Checks
  'Select upto 1',
  'Select upto 2',
  'Select upto 3',
  'Select upto 4',
  'Select upto 5'
]

Instance Method Summary collapse

Instance Method Details

#category_partialObject



71
72
73
# File 'app/models/effective/poll_question.rb', line 71

def category_partial
  category.to_s.parameterize.underscore
end

#poll_question_option?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'app/models/effective/poll_question.rb', line 67

def poll_question_option?
  WITH_OPTIONS_CATEGORIES.include?(category)
end

#to_sObject



63
64
65
# File 'app/models/effective/poll_question.rb', line 63

def to_s
  title.presence || 'New Poll Question'
end