Sha256: 2c84f3a86bfd0192011702ba45176e76e6949d0f115d2c252fd068190e4a5160

Contents?: true

Size: 612 Bytes

Versions: 1

Compression:

Stored size: 612 Bytes

Contents

# QuestionGrid
# - Represents a grid layout of a set of questions
#
# :kind         - 'QuestionGrid' for single table inheritance (STI)
# :content      - questions

module Fe
  class QuestionGrid < Element

    has_many :elements, -> { order('position asc, id asc') },
             :class_name => "Element",
             :foreign_key => "question_grid_id",
             :dependent => :nullify

    def num_cols
      num = cols.to_s.split(';').length
      num = 1 if num == 0
      num
    end

    def has_response?(answer_sheet = nil)
      elements.any? {|e| e.has_response?(answer_sheet)}
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fe-1.0.0 app/models/fe/question_grid.rb