I am trying to get Ransack search set up. I have added the gem to the Gem file, run bundle install.
I have then added:
class ProfilesController < ApplicationController
# GET /profiles
def index
@search = Profile.search(params[:q])
@profiles = @search.result
end
end
In the index view file I have added: (screenname is a valid field in my profiles table)
<% = search_form_for @search do |f| %>
<%= f.label :screenname %>
<%= f.text_field :screenname %>
<%= f.submit "Search" %>
<% end %>
(along with some other styles)
However I am getting:
undefined method `search' for #
in app/controllers/profiles_controller.rb:12:in `index'
Any ideas?
Cheers :)
You should restart your application server after installing gem.