Sha256: 945839e147a00f9ef3a685ab242ae1f7dbe923cca53d2b301f16d1652604fc3f

Contents?: true

Size: 441 Bytes

Versions: 1

Compression:

Stored size: 441 Bytes

Contents

module Highrise
  module HasSubjectData

    def subject_data_hash
      if attributes.has_key?(:subject_datas)
        Hash[subject_datas.map(&:attributes).map {|attrs| [attrs[:subject_field_label].to_s.underscore, attrs[:value]] }]
      else
        {}
      end
    end

    def field(field_name)
      (attributes["subject_datas"] || []).detect do |sd|
        sd.subject_field_label == field_name.to_s
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
peterosullivan-highrise-3.0.7 lib/highrise/has_subject_data.rb