Module: ActiveRecord::Tablefree::ClassMethods

Defined in:
lib/activerecord/tablefree.rb

Instance Method Summary collapse

Instance Method Details

#connectionObject


171
172
173
# File 'lib/activerecord/tablefree.rb', line 171

def connection
  @_connection ||= ActiveRecord::Tablefree::Connection.new
end

#from_query_string(query_string) ⇒ Object


155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/activerecord/tablefree.rb', line 155

def from_query_string(query_string)
  if query_string.blank?
    new
  else
    params = query_string.split('&').collect do |chunk|
      next if chunk.empty?
      key, value = chunk.split('=', 2)
      next if key.empty?
      value = value.nil? ? nil : CGI.unescape(value)
      [CGI.unescape(key), value]
    end.compact.to_h

    new(params)
  end
end