Sha256: c3fdef5423b08524c6d4295d8107dc4baf757a1972727151b89e6efb9338d2b3
Contents?: true
Size: 441 Bytes
Versions: 2
Compression:
Stored size: 441 Bytes
Contents
module Netzke::ActiveRecord::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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
netzke-basepack-0.6.2 | lib/netzke/active_record/combobox_options.rb |
netzke-basepack-0.6.1 | lib/netzke/active_record/combobox_options.rb |