Last active
December 15, 2015 02:55
-
-
Save austinklenk/c3eb95292b5c41b2f6ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Customer Search that works | |
### Search Field in Customer Index Page with Table | |
``` | |
<%= search_form_for @search do |f| %> | |
<th colspan="2"><%= f.text_field :lastName_cont, class: 'customer-search', placeholder: 'Search By Last Name' %></th> | |
<th><%= f.submit "Search", class: 'btn btn-info btn-block' %></th> | |
<% end %> | |
``` | |
# Customer Index Controller Action | |
``` | |
@search = Customer.search(params[:q]) | |
@clients = @search.result.paginate(:page => params[:page]).reverse_order | |
``` | |
# Customer Model for Pagination | |
``` | |
WillPaginate.per_page = 20 | |
``` | |
**The Above works, what i am trying to do now is to create a search action for the orders which are nested under campers** | |
# Search Field in Camper Show | |
``` | |
<%= search_form_for @search do |f| %> | |
<th colspan="2"><%= f.text_field :title_cont, class: 'customer-search', placeholder: 'Search By Last Name' %></th> | |
<th><%= f.submit "Search", class: 'btn btn-info btn-block' %></th> | |
<% end %> | |
``` | |
# Camper Controller Show Action | |
``` | |
@jobs = @camper.orders | |
@search = @jobs.search(params[:q]) | |
@projects = @search.result.paginate(:page => params[:page]).reverse_order | |
``` | |
# Camper Model | |
``` | |
WillPaginate.per_page = 20 | |
``` | |
And get the error of | |
```undefined method `orders_path' | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment