Created
November 11, 2016 15:52
-
-
Save kajatiger/307054e428d25a99600abf20e108cf90 to your computer and use it in GitHub Desktop.
not sure if this is enough to separate development search terms from production search terms
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
class ProductsController < ApplicationController | |
before_action :set_product, only: [:show, :edit, :update, :destroy] | |
# GET /products | |
# GET /products.json | |
if RAILS_ENV == "development" | |
def index | |
if params[:q] | |
search_term = params[:q] | |
@products = Product.where("name LIKE ?", "%#{search_term}%") | |
else | |
@products = Product.all | |
end | |
end | |
else | |
def index | |
if params[:q] | |
search_term = params[:q] | |
@products = Product.where("name ilike ?", "%#{search_term}%") | |
else | |
@products = Product.all | |
end | |
end | |
end | |
def landing_page | |
@products = Product.limit(3) | |
search_term = params[:q] | |
end | |
... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment