Login to use this feature.
15760
2D Graphics
2238
3D Graphics
176
Audio Editing
189
Databases
2944
Miscellaneous
4664
Operating Systems
320
Video Editing
7003
Website Development
|
|
April 3rd, 2019
Contact Us page now working!
March 24th, 2019
Tutorial avatars uploading issue fixed
March 22nd, 2019
IP Blacklist banning issue
March 20th, 2019
Operation Fix P2L - March 19th Update
June 15th, 2018
Guess who's coming back to P2L?
|
Here are the steps:
- 3 changes need to be made
1.) Install a gem called "ransack" in your gemfile
gem 'ransack'
and then => Bundle install
2.)Controller changes : Create a search method.
@search = Product.search(params[:q])
@products = @search.result
3.)Index changes :
<%= search_form_for @search do |f|%>
<%= f.label :Product_Name_cont, "Name contains" %>
<%= f.text_field :Product_Name_cont %>
<%= f.submit "Search" %>
<% end %>
My table name : Products
Field name (by which to search):Product_Name
And this will help you search by keyword in a Rails database.
Hope it helps.
Cheers~