Sha256: 2efb21ec42080523eb66ef03deed5e650bad2aa65c30bb485ef4213b27c9e3b3

Contents?: true

Size: 439 Bytes

Versions: 2

Compression:

Stored size: 439 Bytes

Contents

module Admin::AssociationCommon

  def to_s
    self.name
  end

  def self.included mod
    mod.extend ClassMethods
  end

  module ClassMethods
    def list_for_select(params = {})
      select = []
      select << ['', ''] if params[:add_empty_option]
      if params[:reverse]
        select.concat all.collect{|c|[c.to_s, c.id]}
      else
        select.concat all.collect{|c|[c.id, c.to_s]}
      end
      select
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
carnival-0.0.11 test/dummy/app/models/admin/association_common.rb
carnival-0.0.10 test/dummy/app/models/admin/association_common.rb