Method: Bj::Table::Config::ClassMethods#get

Defined in:
lib/bj/table.rb

#get(key, options = {}) ⇒ Object



239
240
241
242
243
244
245
246
# File 'lib/bj/table.rb', line 239

def get key, options = {}
  transaction do
    options.to_options!
    hostname = options[:hostname] || Bj.hostname
    record = find :first, :conditions => conditions(:key => key, :hostname => hostname) 
    record ? record.value : default_for(key) 
  end
end