Module: ActiveRecord::Tableless::ClassMethods
- Defined in:
- lib/activerecord-tableless.rb
Instance Method Summary collapse
Instance Method Details
#connection ⇒ Object
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/activerecord-tableless.rb', line 201 def connection conn = Object.new() def conn.quote_table_name(*args) "" end def conn.substitute_at(*args) nil end def conn.schema_cache(*args) schema_cache = Object.new() def schema_cache.columns_hash(*args) Hash.new() end schema_cache end conn end |
#from_query_string(query_string) ⇒ Object
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/activerecord-tableless.rb', line 185 def from_query_string(query_string) unless query_string.blank? 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) else new end end |