Sha256: 739c02fad56b11864f3deaa90dad671b8ddc3bf4ac86076b76b0dbc91e5c41ba

Contents?: true

Size: 600 Bytes

Versions: 1

Compression:

Stored size: 600 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') },
             :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-0.0.4 app/models/fe/question_grid.rb