Module: ActiveRecord::Tablefree::ClassMethods

Defined in:
lib/activerecord/tablefree.rb

Instance Method Summary collapse

Instance Method Details

#connectionObject



175
176
177
# File 'lib/activerecord/tablefree.rb', line 175

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

#from_query_string(query_string) ⇒ Object



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/activerecord/tablefree.rb', line 159

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