Sha256: 719b1b0976940606bbc75a2256a80b287a53189930005ad8cefc2a82d91e4c9b
Contents?: true
Size: 507 Bytes
Versions: 12
Compression:
Stored size: 507 Bytes
Contents
module Netzke module ActiveRecord module ComboboxOptions module ClassMethods def netzke_combo_options_for(column, query = "") records = query.empty? ? find_by_sql("select distinct #{column} from #{table_name}") : find_by_sql("select distinct #{column} from #{table_name} where #{column} like '#{query}%'") records.map{|r| r.send(column)} end end def self.included(receiver) receiver.extend ClassMethods end end end end
Version data entries
12 entries across 12 versions & 2 rubygems