I am working with Railsspace social networking book. I stuck in the
problem when i am doing paginate for the search result. It gives the
following error.
NoMethodError in CommunityController#index
undefined method `paginate' for #<CommunityController:0x57436f0>
My Controller Index page coding is below
def index
@title = "Community"
@letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("")
if params[:id]
@initial = params[:id]
@pages, specs = paginate(:specs,
:conditions => ["last_name LIKE ?", @initial+"%"],
:order => "last_name, first_name")
@users = specs.collect { |spec| spec.user }
end
end
You dont have a "def paginate " method defined in your controller.
Anyway you'll probably want to use a pagination gem such as Kaminari,
which
includes all you need for that purpose.
Hi Juan,
Thanks for the help message. Juan I am newbie on ROR could you please
help me how to install kaminari.
Is it right command to run "gem install kaminari" as I am working on
windows.
It’s right, but your best approach is to add ‘gem kaminari’ to your Gemfile and to use rvm.
I don’t have much experience on rails + windows issues, but I know they can be a real pain, so I’d also suggest that you use linux instead for rails development, in a virtual machine if for some reason you can’t install linux in your computer.