lib/rsolr/connectable.rb in rsolr-1.0.0.beta2 vs lib/rsolr/connectable.rb in rsolr-1.0.0.beta3
- old
+ new
@@ -49,12 +49,14 @@
# :data
# :uri
# :path
# :query
def build_request path, opts
+ raise "path must be a string or symbol, not #{path.inspect}" unless [String,Symbol].include?(path.class)
+ path = path.to_s
opts[:method] ||= :get
raise "The :data option can only be used if :method => :post" if opts[:method] != :post and opts[:data]
- opts[:params] = opts[:params].nil? ? {:wt => :ruby} : opts[:params].merge(:wt => :ruby)
+ opts[:params] = opts[:params].nil? ? {:wt => :ruby} : {:wt => :ruby}.merge(opts[:params])
query = RSolr::Uri.params_to_solr(opts[:params]) unless opts[:params].empty?
opts[:query] = query
if opts[:data].is_a? Hash
opts[:data] = RSolr::Uri.params_to_solr opts[:data]
opts[:headers] ||= {}
\ No newline at end of file