title: Ruby on Rails app categories not working or sorting on heroku
body: <p>I created Products that each have a category based on their gender. Everything works fine in my localhost but in Heroku when I press each category it doesn't sort out the products like in my localhost. The browser shows -> herokuapp.com/products?category=Trajes+de+Ba%C3%B1o but doesn't do what its suppose to. </p>
  
  <p><strong>My Products controller:</strong></p>
  
  <pre><code>  def index
      if params.key?(:category)
        @category = Category.find_by_name(params[:category])
        @pagy, @products = pagy(Product.where(category: @category))
      else
        @pagy, @products = pagy(Product.search(params[:search]), items: 9)
      end
    end
  
    def women
      if params.key?(:category)
        @category = Category.find_by_name(params[:category])
        @women_product_items = Product.where(category: @category)
      else
        @women_product_items = Product.women.search(params[:search])
      end
    end
  
    def men
      if params.key?(:category)
        @category = Category.find_by_name(params[:category])
        @men_product_items = Product.where(category: @category)
      else
        @men_product_items = Product.men.search(params[:search])
      end
    end
  
    def kids
      if params.key?(:category)
        @category = Category.find_by_name(params[:category])
        @kids_product_items = Product.where(category: @category)
      else
        @kids_product_items = Product.kids.search(params[:search])
      end
    end
  </code></pre>
  
  <p><strong>Here is everything that appeared in heroku logs:</strong></p>
  
  <pre><code>
  2019-09-06T02:44:31.278950+00:00 app[web.1]: D, [2019-09-06T02:44:31.278862 #4] DEBUG -- : [a5f8d022-718a-4776-868f-f5466372df4d]   Category Load (1.1ms)  SELECT "categories".* FROM "categories"
  2019-09-06T02:44:31.281137+00:00 app[web.1]: D, [2019-09-06T02:44:31.281040 #4] DEBUG -- : [a5f8d022-718a-4776-868f-f5466372df4d]   Category Load (1.0ms)  SELECT "categories".* FROM "categories" WHERE "categories"."display_in_women" = $1  [["display_in_women", true]]
  2019-09-06T02:44:31.282908+00:00 app[web.1]: D, [2019-09-06T02:44:31.282824 #4] DEBUG -- : [a5f8d022-718a-4776-868f-f5466372df4d]   Category Load (1.1ms)  SELECT "categories".* FROM "categories" WHERE "categories"."display_in_men" = $1  [["display_in_men", true]]
  2019-09-06T02:44:31.285129+00:00 app[web.1]: D, [2019-09-06T02:44:31.285054 #4] DEBUG -- : [a5f8d022-718a-4776-868f-f5466372df4d]   Category Load (1.5ms)  SELECT "categories".* FROM "categories" WHERE "categories"."display_in_kids" = $1  [["display_in_kids", true]]
  2019-09-06T02:44:31.287025+00:00 app[web.1]: D, [2019-09-06T02:44:31.286953 #4] DEBUG -- : [a5f8d022-718a-4776-868f-f5466372df4d]    (1.1ms)  SELECT COUNT(*) FROM (SELECT  1 AS one FROM "products" LIMIT $1 OFFSET $2) subquery_for_count  [["LIMIT", 2], ["OFFSET", 0]]
  2019-09-06T02:44:31.287960+00:00 app[web.1]: I, [2019-09-06T02:44:31.287855 #4]  INFO -- : [a5f8d022-718a-4776-868f-f5466372df4d]   Rendered products/index.html.erb within layouts/application (18.8ms)
  2019-09-06T02:44:31.288971+00:00 app[web.1]: I, [2019-09-06T02:44:31.288898 #4]  INFO -- : [a5f8d022-718a-4776-868f-f5466372df4d]   Rendered shared/_message.html.erb (0.1ms)
  2019-09-06T02:44:31.289409+00:00 app[web.1]: I, [2019-09-06T02:44:31.289337 #4]  INFO -- : [a5f8d022-718a-4776-868f-f5466372df4d]   Rendered shared/_footer.html.erb (0.2ms)
  2019-09-06T02:44:31.289688+00:00 app[web.1]: I, [2019-09-06T02:44:31.289617 #4]  INFO -- : [a5f8d022-718a-4776-868f-f5466372df4d] Completed 200 OK in 26ms (Views: 12.9ms | ActiveRecord: 10.3ms)
  2019-09-06T02:44:33.867737+00:00 heroku[router]: at=info method=GET path="/products?category=Vestidos" host=rv10online1.herokuapp.com request_id=b54d57b8-b1c1-45dd-8b48-6227307f7ecc fwd="190.186.94.69" dyno=web.1 connect=1ms service=34ms status=200 bytes=17170 protocol=https
  2019-09-06T02:44:33.833194+00:00 app[web.1]: I, [2019-09-06T02:44:33.833060 #4]  INFO -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc] Started GET "/products?category=Vestidos" for 190.186.94.69 at 2019-09-06 02:44:33 +0000
  2019-09-06T02:44:33.834328+00:00 app[web.1]: I, [2019-09-06T02:44:33.834239 #4]  INFO -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc] Processing by ProductsController#index as HTML
  2019-09-06T02:44:33.834433+00:00 app[web.1]: I, [2019-09-06T02:44:33.834346 #4]  INFO -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc]   Parameters: {"category"=&gt;"Vestidos"}
  2019-09-06T02:44:33.838292+00:00 app[web.1]: D, [2019-09-06T02:44:33.838202 #4] DEBUG -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc]   Cart Load (1.1ms)  SELECT  "carts".* FROM "carts" WHERE "carts"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  2019-09-06T02:44:33.842374+00:00 app[web.1]: D, [2019-09-06T02:44:33.842258 #4] DEBUG -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc]   Category Load (1.1ms)  SELECT  "categories".* FROM "categories" WHERE "categories"."name" = $1 LIMIT $2  [["name", "Vestidos"], ["LIMIT", 1]]
  2019-09-06T02:44:33.844310+00:00 app[web.1]: D, [2019-09-06T02:44:33.844218 #4] DEBUG -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc]    (1.1ms)  SELECT COUNT(*) FROM "products" WHERE "products"."category" = $1  [["category", "2"]]
  2019-09-06T02:44:33.844920+00:00 app[web.1]: I, [2019-09-06T02:44:33.844840 #4]  INFO -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc]   Rendering products/index.html.erb within layouts/application
  2019-09-06T02:44:33.847723+00:00 app[web.1]: D, [2019-09-06T02:44:33.847634 #4] DEBUG -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc]   ProductItem Load (1.1ms)  SELECT "product_items".* FROM "product_items" WHERE "product_items"."cart_id" = $1  [["cart_id", 1]]
  2019-09-06T02:44:33.849519+00:00 app[web.1]: D, [2019-09-06T02:44:33.849407 #4] DEBUG -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc]   Product Load (1.0ms)  SELECT  "products".* FROM "products" WHERE "products"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  2019-09-06T02:44:33.850437+00:00 app[web.1]: I, [2019-09-06T02:44:33.850364 #4]  INFO -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc]   Rendered shared/_header.html.erb (5.3ms)
  2019-09-06T02:44:33.852025+00:00 app[web.1]: D, [2019-09-06T02:44:33.851948 #4] DEBUG -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc]   Category Load (1.0ms)  SELECT "categories".* FROM "categories"
  2019-09-06T02:44:33.854255+00:00 app[web.1]: D, [2019-09-06T02:44:33.854171 #4] DEBUG -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc]   Category Load (1.1ms)  SELECT "categories".* FROM "categories" WHERE "categories"."display_in_women" = $1  [["display_in_women", true]]
  2019-09-06T02:44:33.856209+00:00 app[web.1]: D, [2019-09-06T02:44:33.856105 #4] DEBUG -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc]   Category Load (1.1ms)  SELECT "categories".* FROM "categories" WHERE "categories"."display_in_men" = $1  [["display_in_men", true]]
  2019-09-06T02:44:33.858104+00:00 app[web.1]: D, [2019-09-06T02:44:33.857965 #4] DEBUG -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc]   Category Load (1.1ms)  SELECT "categories".* FROM "categories" WHERE "categories"."display_in_kids" = $1  [["display_in_kids", true]]
  2019-09-06T02:44:33.860343+00:00 app[web.1]: D, [2019-09-06T02:44:33.860241 #4] DEBUG -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc]    (1.3ms)  SELECT COUNT(*) FROM (SELECT  1 AS one FROM "products" WHERE "products"."category" = $1 LIMIT $2 OFFSET $3) subquery_for_count  [["category", "2"], ["LIMIT", 20], ["OFFSET", 0]]
  2019-09-06T02:44:33.861429+00:00 app[web.1]: I, [2019-09-06T02:44:33.861337 #4]  INFO -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc]   Rendered products/index.html.erb within layouts/application (16.3ms)
  2019-09-06T02:44:33.862430+00:00 app[web.1]: I, [2019-09-06T02:44:33.862360 #4]  INFO -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc]   Rendered shared/_message.html.erb (0.1ms)
  2019-09-06T02:44:33.862898+00:00 app[web.1]: I, [2019-09-06T02:44:33.862823 #4]  INFO -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc]   Rendered shared/_footer.html.erb (0.2ms)
  2019-09-06T02:44:33.863171+00:00 app[web.1]: I, [2019-09-06T02:44:33.863109 #4]  INFO -- : [b54d57b8-b1c1-45dd-8b48-6227307f7ecc] Completed 200 OK in 29ms (Views: 10.7ms | ActiveRecord: 11.1ms)
  2019-09-06T02:44:36.214279+00:00 app[web.1]: I, [2019-09-06T02:44:36.214158 #4]  INFO -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d] Started GET "/products?category=Trajes+de+Ba%C3%B1o" for 190.186.94.69 at 2019-09-06 02:44:36 +0000
  2019-09-06T02:44:36.215542+00:00 app[web.1]: I, [2019-09-06T02:44:36.215462 #4]  INFO -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d] Processing by ProductsController#index as HTML
  2019-09-06T02:44:36.215661+00:00 app[web.1]: I, [2019-09-06T02:44:36.215585 #4]  INFO -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d]   Parameters: {"category"=&gt;"Trajes de Baño"}
  2019-09-06T02:44:36.219518+00:00 app[web.1]: D, [2019-09-06T02:44:36.219446 #4] DEBUG -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d]   Cart Load (1.1ms)  SELECT  "carts".* FROM "carts" WHERE "carts"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  2019-09-06T02:44:36.221116+00:00 app[web.1]: D, [2019-09-06T02:44:36.221047 #4] DEBUG -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d]   Category Load (1.0ms)  SELECT  "categories".* FROM "categories" WHERE "categories"."name" = $1 LIMIT $2  [["name", "Trajes de Baño"], ["LIMIT", 1]]
  2019-09-06T02:44:36.223098+00:00 app[web.1]: D, [2019-09-06T02:44:36.222964 #4] DEBUG -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d]    (1.1ms)  SELECT COUNT(*) FROM "products" WHERE "products"."category" = $1  [["category", "1"]]
  2019-09-06T02:44:36.223772+00:00 app[web.1]: I, [2019-09-06T02:44:36.223657 #4]  INFO -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d]   Rendering products/index.html.erb within layouts/application
  2019-09-06T02:44:36.226326+00:00 app[web.1]: D, [2019-09-06T02:44:36.226255 #4] DEBUG -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d]   ProductItem Load (1.0ms)  SELECT "product_items".* FROM "product_items" WHERE "product_items"."cart_id" = $1  [["cart_id", 1]]
  2019-09-06T02:44:36.228395+00:00 app[web.1]: D, [2019-09-06T02:44:36.228293 #4] DEBUG -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d]   Product Load (1.1ms)  SELECT  "products".* FROM "products" WHERE "products"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  2019-09-06T02:44:36.229854+00:00 app[web.1]: I, [2019-09-06T02:44:36.229750 #4]  INFO -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d]   Rendered shared/_header.html.erb (5.8ms)
  2019-09-06T02:44:36.231757+00:00 app[web.1]: D, [2019-09-06T02:44:36.231670 #4] DEBUG -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d]   Category Load (1.0ms)  SELECT "categories".* FROM "categories"
  2019-09-06T02:44:36.233896+00:00 app[web.1]: D, [2019-09-06T02:44:36.233816 #4] DEBUG -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d]   Category Load (1.0ms)  SELECT "categories".* FROM "categories" WHERE "categories"."display_in_women" = $1  [["display_in_women", true]]
  2019-09-06T02:44:36.235653+00:00 app[web.1]: D, [2019-09-06T02:44:36.235558 #4] DEBUG -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d]   Category Load (1.0ms)  SELECT "categories".* FROM "categories" WHERE "categories"."display_in_men" = $1  [["display_in_men", true]]
  2019-09-06T02:44:36.237335+00:00 app[web.1]: D, [2019-09-06T02:44:36.237254 #4] DEBUG -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d]   Category Load (1.0ms)  SELECT "categories".* FROM "categories" WHERE "categories"."display_in_kids" = $1  [["display_in_kids", true]]
  2019-09-06T02:44:36.239486+00:00 app[web.1]: D, [2019-09-06T02:44:36.239407 #4] DEBUG -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d]    (1.1ms)  SELECT COUNT(*) FROM (SELECT  1 AS one FROM "products" WHERE "products"."category" = $1 LIMIT $2 OFFSET $3) subquery_for_count  [["category", "1"], ["LIMIT", 2], ["OFFSET", 0]]
  2019-09-06T02:44:36.240293+00:00 app[web.1]: I, [2019-09-06T02:44:36.240219 #4]  INFO -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d]   Rendered products/index.html.erb within layouts/application (16.4ms)
  2019-09-06T02:44:36.241070+00:00 app[web.1]: I, [2019-09-06T02:44:36.240974 #4]  INFO -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d]   Rendered shared/_message.html.erb (0.0ms)
  2019-09-06T02:44:36.241494+00:00 app[web.1]: I, [2019-09-06T02:44:36.241422 #4]  INFO -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d]   Rendered shared/_footer.html.erb (0.2ms)
  2019-09-06T02:44:36.241755+00:00 app[web.1]: I, [2019-09-06T02:44:36.241685 #4]  INFO -- : [93681d9a-5f2d-4931-97ee-4337ae9df01d] Completed 200 OK in 26ms (Views: 10.9ms | ActiveRecord: 10.6ms)
  2019-09-06T02:44:36.246559+00:00 heroku[router]: at=info method=GET path="/products?category=Trajes+de+Ba%C3%B1o" host=rv10online1.herokuapp.com request_id=93681d9a-5f2d-4931-97ee-4337ae9df01d fwd="190.186.94.69" dyno=web.1 connect=1ms service=32ms status=200 bytes=17172 protocol=https
  2019-09-06T02:46:18.111771+00:00 app[web.1]: I, [2019-09-06T02:46:18.111631 #4]  INFO -- : [e1f7c77d-79e4-452b-ada4-79f6ae54d7c3] Started GET "/" for 190.186.94.69 at 2019-09-06 02:46:18 +0000
  2019-09-06T02:46:18.113344+00:00 app[web.1]: I, [2019-09-06T02:46:18.113249 #4]  INFO -- : [e1f7c77d-79e4-452b-ada4-79f6ae54d7c3] Processing by PagesController#index as HTML
  2019-09-06T02:46:18.117709+00:00 app[web.1]: D, [2019-09-06T02:46:18.117611 #4] DEBUG -- : [e1f7c77d-79e4-452b-ada4-79f6ae54d7c3]   Cart Load (1.1ms)  SELECT  "carts".* FROM "carts" WHERE "carts"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  2019-09-06T02:46:18.120089+00:00 app[web.1]: I, [2019-09-06T02:46:18.119991 #4]  INFO -- : [e1f7c77d-79e4-452b-ada4-79f6ae54d7c3]   Rendering pages/index.html.erb within layouts/application
  2019-09-06T02:46:18.128335+00:00 app[web.1]: D, [2019-09-06T02:46:18.128208 #4] DEBUG -- : [e1f7c77d-79e4-452b-ada4-79f6ae54d7c3]   ProductItem Load (1.2ms)  SELECT "product_items".* FROM "product_items" WHERE "product_items"."cart_id" = $1  [["cart_id", 1]]
  2019-09-06T02:46:18.130683+00:00 app[web.1]: D, [2019-09-06T02:46:18.130598 #4] DEBUG -- : [e1f7c77d-79e4-452b-ada4-79f6ae54d7c3]   Product Load (1.1ms)  SELECT  "products".* FROM "products" WHERE "products"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  2019-09-06T02:46:18.133528+00:00 app[web.1]: I, [2019-09-06T02:46:18.133432 #4]  INFO -- : [e1f7c77d-79e4-452b-ada4-79f6ae54d7c3]   Rendered shared/_navbarhome.html.erb (11.4ms)
  2019-09-06T02:46:18.134039+00:00 app[web.1]: I, [2019-09-06T02:46:18.133948 #4]  INFO -- : [e1f7c77d-79e4-452b-ada4-79f6ae54d7c3]   Rendered pages/index.html.erb within layouts/application (13.8ms)
  2019-09-06T02:46:18.135483+00:00 app[web.1]: I, [2019-09-06T02:46:18.135378 #4]  INFO -- : [e1f7c77d-79e4-452b-ada4-79f6ae54d7c3]   Rendered shared/_message.html.erb (0.1ms)
  2019-09-06T02:46:18.136125+00:00 app[web.1]: I, [2019-09-06T02:46:18.136027 #4]  INFO -- : [e1f7c77d-79e4-452b-ada4-79f6ae54d7c3]   Rendered shared/_footer.html.erb (0.3ms)
  2019-09-06T02:46:18.136649+00:00 app[web.1]: I, [2019-09-06T02:46:18.136527 #4]  INFO -- : [e1f7c77d-79e4-452b-ada4-79f6ae54d7c3] Completed 200 OK in 23ms (Views: 14.8ms | ActiveRecord: 3.4ms)
  2019-09-06T02:46:18.141534+00:00 heroku[router]: at=info method=GET path="/" host=rv10online1.herokuapp.com request_id=e1f7c77d-79e4-452b-ada4-79f6ae54d7c3 fwd="190.186.94.69" dyno=web.1 connect=1ms service=30ms status=200 bytes=27460 protocol=https
  2019-09-06T02:46:19.210969+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=rv10online1.herokuapp.com request_id=8eb72357-1ffb-42e5-b5d4-5db8bd58f2f4 fwd="190.186.94.69" dyno=web.1 connect=1ms service=1ms status=304 bytes=48 protocol=https
  2019-09-06T02:46:28.096164+00:00 heroku[router]: at=info method=GET path="/products" host=rv10online1.herokuapp.com request_id=63de8dcb-4c8a-45ca-b43a-216a8b640fc7 fwd="190.186.94.69" dyno=web.1 connect=1ms service=29ms status=200 bytes=17168 protocol=https
  2019-09-06T02:46:28.066874+00:00 app[web.1]: I, [2019-09-06T02:46:28.066768 #4]  INFO -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7] Started GET "/products" for 190.186.94.69 at 2019-09-06 02:46:28 +0000
  2019-09-06T02:46:28.067767+00:00 app[web.1]: I, [2019-09-06T02:46:28.067691 #4]  INFO -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7] Processing by ProductsController#index as HTML
  2019-09-06T02:46:28.071557+00:00 app[web.1]: D, [2019-09-06T02:46:28.071477 #4] DEBUG -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7]   Cart Load (1.1ms)  SELECT  "carts".* FROM "carts" WHERE "carts"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  2019-09-06T02:46:28.073373+00:00 app[web.1]: D, [2019-09-06T02:46:28.073301 #4] DEBUG -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7]    (1.1ms)  SELECT COUNT(*) FROM "products"
  2019-09-06T02:46:28.074116+00:00 app[web.1]: I, [2019-09-06T02:46:28.074048 #4]  INFO -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7]   Rendering products/index.html.erb within layouts/application
  2019-09-06T02:46:28.076913+00:00 app[web.1]: D, [2019-09-06T02:46:28.076825 #4] DEBUG -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7]   ProductItem Load (1.1ms)  SELECT "product_items".* FROM "product_items" WHERE "product_items"."cart_id" = $1  [["cart_id", 1]]
  2019-09-06T02:46:28.078737+00:00 app[web.1]: D, [2019-09-06T02:46:28.078671 #4] DEBUG -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7]   Product Load (1.0ms)  SELECT  "products".* FROM "products" WHERE "products"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  2019-09-06T02:46:28.079737+00:00 app[web.1]: I, [2019-09-06T02:46:28.079669 #4]  INFO -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7]   Rendered shared/_header.html.erb (5.4ms)
  2019-09-06T02:46:28.081394+00:00 app[web.1]: D, [2019-09-06T02:46:28.081306 #4] DEBUG -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7]   Category Load (1.0ms)  SELECT "categories".* FROM "categories"
  2019-09-06T02:46:28.084184+00:00 app[web.1]: D, [2019-09-06T02:46:28.084082 #4] DEBUG -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7]   Category Load (1.1ms)  SELECT "categories".* FROM "categories" WHERE "categories"."display_in_women" = $1  [["display_in_women", true]]
  2019-09-06T02:46:28.085929+00:00 app[web.1]: D, [2019-09-06T02:46:28.085861 #4] DEBUG -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7]   Category Load (1.0ms)  SELECT "categories".* FROM "categories" WHERE "categories"."display_in_men" = $1  [["display_in_men", true]]
  2019-09-06T02:46:28.087509+00:00 app[web.1]: D, [2019-09-06T02:46:28.087417 #4] DEBUG -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7]   Category Load (1.0ms)  SELECT "categories".* FROM "categories" WHERE "categories"."display_in_kids" = $1  [["display_in_kids", true]]
  2019-09-06T02:46:28.089611+00:00 app[web.1]: D, [2019-09-06T02:46:28.089535 #4] DEBUG -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7]    (1.1ms)  SELECT COUNT(*) FROM (SELECT  1 AS one FROM "products" LIMIT $1 OFFSET $2) subquery_for_count  [["LIMIT", 2], ["OFFSET", 0]]
  2019-09-06T02:46:28.090452+00:00 app[web.1]: I, [2019-09-06T02:46:28.090372 #4]  INFO -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7]   Rendered products/index.html.erb within layouts/application (16.2ms)
  2019-09-06T02:46:28.091306+00:00 app[web.1]: I, [2019-09-06T02:46:28.091224 #4]  INFO -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7]   Rendered shared/_message.html.erb (0.1ms)
  2019-09-06T02:46:28.091769+00:00 app[web.1]: I, [2019-09-06T02:46:28.091697 #4]  INFO -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7]   Rendered shared/_footer.html.erb (0.2ms)
  2019-09-06T02:46:28.092062+00:00 app[web.1]: I, [2019-09-06T02:46:28.091992 #4]  INFO -- : [63de8dcb-4c8a-45ca-b43a-216a8b640fc7] Completed 200 OK in 24ms (Views: 10.8ms | ActiveRecord: 9.5ms)
  2019-09-06T02:46:31.169628+00:00 app[web.1]: I, [2019-09-06T02:46:31.169479 #4]  INFO -- : [c74c9d36-41d7-4976-95aa-0274c995de7e] Started GET "/products?category=Trajes+de+Ba%C3%B1o" for 190.186.94.69 at 2019-09-06 02:46:31 +0000
  2019-09-06T02:46:31.170479+00:00 app[web.1]: I, [2019-09-06T02:46:31.170391 #4]  INFO -- : [c74c9d36-41d7-4976-95aa-0274c995de7e] Processing by ProductsController#index as HTML
  2019-09-06T02:46:31.170564+00:00 app[web.1]: I, [2019-09-06T02:46:31.170481 #4]  INFO -- : [c74c9d36-41d7-4976-95aa-0274c995de7e]   Parameters: {"category"=&gt;"Trajes de Baño"}
  2019-09-06T02:46:31.174169+00:00 app[web.1]: D, [2019-09-06T02:46:31.174093 #4] DEBUG -- : [c74c9d36-41d7-4976-95aa-0274c995de7e]   Cart Load (1.1ms)  SELECT  "carts".* FROM "carts" WHERE "carts"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  2019-09-06T02:46:31.175844+00:00 app[web.1]: D, [2019-09-06T02:46:31.175750 #4] DEBUG -- : [c74c9d36-41d7-4976-95aa-0274c995de7e]   Category Load (1.0ms)  SELECT  "categories".* FROM "categories" WHERE "categories"."name" = $1 LIMIT $2  [["name", "Trajes de Baño"], ["LIMIT", 1]]
  2019-09-06T02:46:31.177865+00:00 app[web.1]: D, [2019-09-06T02:46:31.177767 #4] DEBUG -- : [c74c9d36-41d7-4976-95aa-0274c995de7e]    (1.1ms)  SELECT COUNT(*) FROM "products" WHERE "products"."category" = $1  [["category", "1"]]
  2019-09-06T02:46:31.178481+00:00 app[web.1]: I, [2019-09-06T02:46:31.178408 #4]  INFO -- : [c74c9d36-41d7-4976-95aa-0274c995de7e]   Rendering products/index.html.erb within layouts/application
  2019-09-06T02:46:31.181097+00:00 app[web.1]: D, [2019-09-06T02:46:31.180999 #4] DEBUG -- : [c74c9d36-41d7-4976-95aa-0274c995de7e]   ProductItem Load (1.0ms)  SELECT "product_items".* FROM "product_items" WHERE "product_items"."cart_id" = $1  [["cart_id", 1]]
  2019-09-06T02:46:31.183479+00:00 app[web.1]: D, [2019-09-06T02:46:31.183400 #4] DEBUG -- : [c74c9d36-41d7-4976-95aa-0274c995de7e]   Product Load (1.0ms)  SELECT  "products".* FROM "products" WHERE "products"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  2019-09-06T02:46:31.184669+00:00 app[web.1]: I, [2019-09-06T02:46:31.184598 #4]  INFO -- : [c74c9d36-41d7-4976-95aa-0274c995de7e]   Rendered shared/_header.html.erb (6.0ms)
  2019-09-06T02:46:31.186785+00:00 app[web.1]: D, [2019-09-06T02:46:31.186685 #4] DEBUG -- : [c74c9d36-41d7-4976-95aa-0274c995de7e]   Category Load (1.1ms)  SELECT "categories".* FROM "categories"
  2019-09-06T02:46:31.189217+00:00 app[web.1]: D, [2019-09-06T02:46:31.189127 #4] DEBUG -- : [c74c9d36-41d7-4976-95aa-0274c995de7e]   Category Load (1.1ms)  SELECT "categories".* FROM "categories" WHERE "categories"."display_in_women" = $1  [["display_in_women", true]]
  2019-09-06T02:46:31.191143+00:00 app[web.1]: D, [2019-09-06T02:46:31.191051 #4] DEBUG -- : [c74c9d36-41d7-4976-95aa-0274c995de7e]   Category Load (1.0ms)  SELECT "categories".* FROM "categories" WHERE "categories"."display_in_men" = $1  [["display_in_men", true]]
  2019-09-06T02:46:31.192982+00:00 app[web.1]: D, [2019-09-06T02:46:31.192885 #4] DEBUG -- : [c74c9d36-41d7-4976-95aa-0274c995de7e]   Category Load (1.0ms)  SELECT "categories".* FROM "categories" WHERE "categories"."display_in_kids" = $1  [["display_in_kids", true]]
  2019-09-06T02:46:31.195143+00:00 app[web.1]: D, [2019-09-06T02:46:31.195065 #4] DEBUG -- : [c74c9d36-41d7-4976-95aa-0274c995de7e]    (1.1ms)  SELECT COUNT(*) FROM (SELECT  1 AS one FROM "products" WHERE "products"."category" = $1 LIMIT $2 OFFSET $3) subquery_for_count  [["category", "1"], ["LIMIT", 2], ["OFFSET", 0]]
  2019-09-06T02:46:31.196208+00:00 app[web.1]: I, [2019-09-06T02:46:31.196142 #4]  INFO -- : [c74c9d36-41d7-4976-95aa-0274c995de7e]   Rendered products/index.html.erb within layouts/application (17.6ms)
  2019-09-06T02:46:31.197537+00:00 app[web.1]: I, [2019-09-06T02:46:31.197460 #4]  INFO -- : [c74c9d36-41d7-4976-95aa-0274c995de7e]   Rendered shared/_message.html.erb (0.1ms)
  2019-09-06T02:46:31.198067+00:00 app[web.1]: I, [2019-09-06T02:46:31.197993 #4]  INFO -- : [c74c9d36-41d7-4976-95aa-0274c995de7e]   Rendered shared/_footer.html.erb (0.3ms)
  2019-09-06T02:46:31.198405+00:00 app[web.1]: I, [2019-09-06T02:46:31.198323 #4]  INFO -- : [c74c9d36-41d7-4976-95aa-0274c995de7e] Completed 200 OK in 28ms (Views: 12.8ms | ActiveRecord: 10.6ms)
  2019-09-06T02:46:31.202707+00:00 heroku[router]: at=info method=GET path="/products?category=Trajes+de+Ba%C3%B1o" host=rv10online1.herokuapp.com request_id=c74c9d36-41d7-4976-95aa-0274c995de7e fwd="190.186.94.69" dyno=web.1 connect=1ms service=33ms status=200 bytes=17168 protocol=https
  </code></pre>
  
  <p>Product page view</p>
  
  <pre><code>&lt;%= render "shared/header" %&gt;
  &lt;div class="containe-fluid" style="background-color: #ebebeb; padding-bottom: 2% !important;"&gt;
     &lt;div class="caption-content text-center"&gt;
        &lt;div class="font-alt mb-30 titan-title-size-1 "&gt;
           &lt;h2 style="font-size:100px;"&gt;&lt;%= image_tag "rv10.png", height: 70 %&gt;&lt;/h2&gt;
        &lt;/div&gt;
        &lt;div class="font-alt mb-30 titan-title-size-4"&gt;
           &lt;p class="description"&gt;50% DE DESCUENTO EN TODO&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class="font-alt mb-40 titan-title-size-1"&gt;
           &lt;p class="description"&gt;
              Usa el codigo &lt;b&gt;SUMMER50&lt;/b&gt;, Oferta EXPIRA en 
              &lt;b&gt;
           &lt;p id="demo"&gt;&lt;/p&gt;&lt;/b&gt;&lt;/p&gt;
        &lt;/div&gt;
     &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="container-fluid" style="margin-top:5%; "&gt;
     &lt;div class="wrap"&gt;
        &lt;div class="left"&gt;
           &lt;!-- Navbar for categories --&gt;
           &lt;div class="categories" style="display:inline-block;"&gt;
              &lt;b&gt;Buscar por Codigo:&lt;/b&gt; &lt;br&gt;
              &lt;br&gt;
              &lt;%= form_tag products_path, :method =&gt; 'get' do %&gt;
              &lt;%= text_field_tag :search, params[:search] %&gt;
              &lt;% end %&gt;
              &lt;b class="titulos"&gt;Todas Las Categorias&lt;/b&gt; &lt;br&gt;
              &lt;%= link_to 'Todas las categorias', products_path %&gt;&lt;br&gt;
              &lt;% Category.all.each do |cat| %&gt;
              &lt;%= link_to cat.name, products_path(category: cat.name) %&gt;
              &lt;br&gt;
              &lt;% end %&gt;
              &lt;!-- end --&gt;
              &lt;br&gt;
              &lt;b class="titulos"&gt;MUJERES&lt;/b&gt; &lt;br&gt;
              &lt;% Category.where(display_in_women: true).each do |cat| %&gt;
              &lt;%= link_to cat.name, products_path(category: cat.name)%&gt;
              &lt;br&gt;
              &lt;% end %&gt;
              &lt;br&gt;
              &lt;b class="titulos"&gt;HOMBRES&lt;/b&gt; &lt;br&gt;
              &lt;% Category.where(display_in_men: true).each do |cat| %&gt;
              &lt;%= link_to cat.name, products_path(category: cat.name)%&gt;
              &lt;br&gt;
              &lt;% end %&gt;
              &lt;br&gt;
              &lt;b class="titulos"&gt;KIDS&lt;/b&gt; &lt;br&gt;
              &lt;% Category.where(display_in_kids: true).each do |cat| %&gt;
              &lt;%= link_to cat.name, products_path(category: cat.name)%&gt;
              &lt;br&gt;
              &lt;% end %&gt;
           &lt;/div&gt;
           &lt;br&gt;
           &lt;br&gt;
           &lt;br&gt;
           &lt;br&gt;
        &lt;/div&gt;
        &lt;!-- close left --&gt;
        &lt;h4 class="titulo"&gt;&lt;b&gt;TODOS LOS PRODUCTOS&lt;/b&gt;&lt;/h4&gt;
        &lt;div class="searcher"&gt;
           &lt;h5&gt;La mejor version de ti mismo. Moda boliviana inspirada en gente activa.&lt;/h5&gt;
        &lt;/div&gt;
        &lt;br&gt;
        &lt;!-- productos --&gt;
        &lt;%== pagy_nav(@pagy) %&gt;&amp;nbsp;&amp;nbsp;
        &lt;div class="quantityproducts"&gt;Productos ( &lt;%= @products.count %&gt; )&lt;/div&gt;
        &lt;hr&gt;
        &lt;div class="row"&gt;
           &lt;% cache do %&gt;
           &lt;% @products.each do |product| %&gt;
           &lt;div class="col-md-3"&gt;
              &lt;div class="product-grid2"&gt;
                 &lt;div class="product-image2"&gt;
                    &lt;a&gt;&lt;%= cl_image_tag product.photo %&gt;&lt;/a&gt;
                    &lt;ul class="social"&gt;
                       &lt;li&gt;&lt;a href="#" data-tip="Quick View"&gt;&lt;i class="fa fa-eye"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
                       &lt;li&gt;&lt;a href="#" data-tip="Add to Cart"&gt;&lt;i class="fa fa-shopping-cart"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
                    &lt;/ul&gt;
                 &lt;/div&gt;
                 &lt;div class="product-content"&gt;
                    &lt;h3 class="title"&gt;&lt;a href="#"&gt;&lt;%= link_to product.title, product %&gt;&lt;/a&gt;&lt;/h3&gt;
                    &lt;% if product.sale_price == 0 %&gt;
                    &lt;p style="font-size:12px;"&gt;&lt;%= number_to_currency_bo product.price %&gt;&lt;/p&gt;
                    &lt;% else %&gt;
                    &lt;p style="display: inline-block; font-size: 12px;"&gt;&lt;i style="text-decoration: line-through;"&gt;&lt;%= number_to_currency_bo product.sale_price %&gt;&lt;/i&gt;&amp;nbsp;&amp;nbsp;&lt;b style="font-weight: 600;"&gt;&lt;%= number_to_currency_bo product.price %&gt;&lt;/b&gt;&lt;/p&gt;
                    &lt;% end %&gt;
                 &lt;/div&gt;
              &lt;/div&gt;
           &lt;/div&gt;
           &lt;% end %&gt;
           &lt;% end %&gt;
        &lt;/div&gt;
     &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;%== pagy_nav(@pagy) %&gt;
  &lt;hr&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;!-- end productos --&gt;
  </code></pre>