Sha256: 974511566dfc2581127adf5051b0dd12a654eef4e069bc8fe33cf03cfc4952ab
Contents?: true
Size: 570 Bytes
Versions: 14
Compression:
Stored size: 570 Bytes
Contents
module GeoConcerns module AuthorityService extend ActiveSupport::Concern included do mattr_accessor :authority end class_methods do def select_options authority.all.map do |element| [element[:label], element[:id]] end end def label(id) (authority.find(id) || {}).fetch('term', nil) end def code(id) (authority.find(id) || {}).fetch('code', nil) end def include?(id) !authority.find(id).nil? && !authority.find(id).empty? end end end end
Version data entries
14 entries across 14 versions & 1 rubygems