'Rails, uninitialized constant Faraday::FlatParamsEncoder in sunspot solr
I'm using rails 4 and sunspot solr, when I pass the params to the controller for performing the search, i'm getting uninitialized constant Faraday::FlatParamsEncoder error
I followed the steps under https://github.com/sunspot/sunspot
My model looks as follow,
Post.rb
class Post < ActiveRecord::Base
  belongs_to :user
  searchable do
     text :title, :description
  end
end
and my controller action is blogs_controllers.rb
def index
  @search = Post.search do
    fulltext params[:search]
  end
  @results = @search.results
end
and the form is as follow,
<form action="<%= posts_search_path %>" method="GET" role="Search">
  <input type="text" name="search" placeholder="Search by post title" required="required">
  <input class="btn btn-default" type="submit" value="Search!">
</form>
not sure why this error is occuring.
Solution 1:[1]
Use of Faraday::FlatParamsEncoder in rsolr was added in version 2.0.0. Faraday::FlatParamsEncoder was added to faraday in version 0.9.0. rsolr does not specify a minimum version of faraday. I've created a pull request to fix this.
Either upgrade faraday to 0.9.0 or above, or downgrade rsolr to a version before 2.0.0.
Solution 2:[2]
Install gem 'faraday' and run bundle install this should resolve the problem.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | jb_314 | 
| Solution 2 | Dennis Njoroge | 
