Method: FactoryForm::Rating#initialize

Defined in:
lib/factoryform/rating.rb

#initialize(options = {}) ⇒ Rating

Returns a new instance of Rating.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/factoryform/rating.rb', line 6

def initialize(options={})
  options[:field_type] = "rating"
  super(options)
  
  # Default is 2 for number of scales
  if options[:scale] && options[:scale].to_i > 1
    self.scale = options[:scale].to_i
  else
    raise(ParameterExpectedException, "Missing rating scale (should be greater than or equal to 2)")
  end

  self.from_label = options[:from_label] || ""
  self.to_label = options[:to_label] || ""
      
end