module Lookupable extend ActiveSupport::Concern def to_lookup { :id => self.id, :code => self.code, :name => self.name } end module ClassMethods def to_lookup all.map do |i| i.to_lookup end end end end