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 up to 1',
  'Select up to 2',
  'Select up to 3',
  'Select up to 4',
  'Select up to 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 up to 1',
  'Select up to 2',
  'Select up to 3',
  'Select up to 4',
  'Select up to 5'
]

Instance Method Summary collapse

Instance Method Details

#category_partialObject



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

def category_partial
  category.to_s.parameterize.underscore
end

#poll_question_option?Boolean

Returns:

  • (Boolean)


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

def poll_question_option?
  WITH_OPTIONS_CATEGORIES.include?(category)
end

#to_sObject



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

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