Module: ActiveRecord::Tableless::ClassMethods
- Defined in:
- lib/activerecord-tableless.rb
Instance Method Summary collapse
Instance Method Details
#connection ⇒ Object
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/activerecord-tableless.rb', line 187 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
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/activerecord-tableless.rb', line 171 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 |