Skip to content

Instantly share code, notes, and snippets.

@ArunGupta25
Created October 27, 2013 05:24
Show Gist options
  • Save ArunGupta25/7178250 to your computer and use it in GitHub Desktop.
Save ArunGupta25/7178250 to your computer and use it in GitHub Desktop.
server error
def index
if params["rawdenim"]
params["raw denim"] = params["rawdenim"]
end
if params[:gotouser] == "yes"
if current_user
redirect_to user_path(current_user.id)
end
end
@perpage = 60
if params[:category]
t = Listing.arel_table
query = t[:category].eq('rooney')
params[:category].each do |category|
if params[category]
params[category].each do |size|
query = query.or(t[:category].eq(category).and(t[:size].eq(size)))
end
end
end
dquery = t[:designer].eq_any(params[:designer])
query = query.and(dquery)
pquery = t[:price].gteq(params[:price][0]).and(t[:price].lteq(params[:price][1]))
query = query.and(pquery)
@listings = Listing.where(query).includes(:photos).page(params[:category_page]).per(@perpage)
#@listings = Listing.where(category: params[:category], designer: params[:designer], sold: nil).includes(:photos).page(params[:category_page]).per(@perpage)
respond_to do |format|
format.js
end
2013-10-26T21:55:01.766123+00:00 app[web.1]: Started GET "/?category%5B%5D=tops&category%5B%5D=bottoms&category%5B%5D=outerwear&category%5B%5D=raw+denim&category%5B%5D=suiting&category%5B%5D=accessories&category%5B%5D=footwear&designer%5B%5D=A.P.C.&designer%5B%5D=Engineered+Garments&designer%5B%5D=Epaulet&designer%5B%5D=J+Crew&designer%5B%5D=LVC&designer%5B%5D=Mark+McNairy&designer%5B%5D=Raf+Simons&designer%5B%5D=Stussy&designer%5B%5D=Wings+and+Horns&price%5B%5D=0&price%5B%5D=250&bottoms%5B%5D=29&bottoms%5B%5D=32&bottoms%5B%5D=32%2F30&bottoms%5B%5D=33&bottoms%5B%5D=34&bottoms%5B%5D=Euro+48&ajax=1" for 172.2.19.53 at 2013-10-26 21:55:01 +0000
2013-10-26T21:55:01.793416+00:00 app[web.1]:
2013-10-26T21:55:01.793416+00:00 app[web.1]: app/views/home/_products.html.haml:1:in `_app_views_home__products_html_haml__2722460913139136253_46419240'
2013-10-26T21:55:01.788568+00:00 app[web.1]: Rendered home/index.js.haml (16.2ms)
2013-10-26T21:55:01.793093+00:00 app[web.1]: 1: - @listings.in_groups_of(3).each do |group|
2013-10-26T21:55:01.788831+00:00 app[web.1]: Completed 500 Internal Server Error in 18ms
2013-10-26T21:55:01.788568+00:00 app[web.1]: Rendered home/_products.html.haml (15.7ms)
2013-10-26T21:55:01.793416+00:00 app[web.1]:
2013-10-26T21:55:01.793093+00:00 app[web.1]: ActionView::Template::Error (PG::AmbiguousColumn: ERROR: column reference "id" is ambiguous
2013-10-26T21:55:01.793416+00:00 app[web.1]: app/views/home/index.js.haml:1:in `_app_views_home_index_js_haml___2992750054795893440_53031460'
2013-10-26T21:55:01.793093+00:00 app[web.1]: LINE 1: SELECT DISTINCT "listings".id, id AS alias_0 FROM "listings...
2013-10-26T21:55:01.793093+00:00 app[web.1]: 2: %ul.grid{ :data => {'columns' => 3} }
2013-10-26T21:55:01.793093+00:00 app[web.1]: : SELECT DISTINCT "listings".id, id AS alias_0 FROM "listings" LEFT OUTER JOIN "photos" ON "photos"."listing_id" = "listings"."id" WHERE ((((((("listings"."category" = 'rooney' OR "listings"."category" = 'bottoms' AND "listings"."size" = '29') OR "listings"."category" = 'bottoms' AND "listings"."size" = '32') OR "listings"."category" = 'bottoms' AND "listings"."size" = '32/30') OR "listings"."category" = 'bottoms' AND "listings"."size" = '33') OR "listings"."category" = 'bottoms' AND "listings"."size" = '34') OR "listings"."category" = 'bottoms' AND "listings"."size" = 'Euro 48') AND ("listings"."designer" = 'A.P.C.' OR "listings"."designer" = 'Engineered Garments' OR "listings"."designer" = 'Epaulet' OR "listings"."designer" = 'J Crew' OR "listings"."designer" = 'LVC' OR "listings"."designer" = 'Mark McNairy' OR "listings"."designer" = 'Raf Simons' OR "listings"."designer" = 'Stussy' OR "listings"."designer" = 'Wings and Horns') AND "listings"."price" >= '0' AND "listings"."price" <= '250') ORDER BY id DES
2013-10-26T21:55:01.793093+00:00 app[web.1]: 3: - if group[0]
2013-10-26T21:55:01.793416+00:00 app[web.1]: app/controllers/home_controller.rb:28:in `index'
2013-10-26T21:55:01.770308+00:00 app[web.1]: Processing by HomeController#index as */*
- @listings.in_groups_of(3).each do |group|
%ul.grid{ :data => {'columns' => 3} }
- if group[0]
%li.first1
- firstlisting = group[0]
.productimage
- if firstlisting.cached_photos_count > 0
= link_to image_tag(firstlisting.photos.first.image_url(:display).to_s), listing_path(firstlisting.id)
- else
.filler
= link_to image_tag("displayfiller.png"), listing_path(firstlisting.id)
.productdesc
.productdesigner
- title = firstlisting.designer + " " + firstlisting.title
= link_to title, listing_path(firstlisting.id)
.productprice
= link_to "$" + firstlisting.price.to_i.to_s, listing_path(firstlisting.id)
.productsize
= link_to firstlisting.size, listing_path(firstlisting.id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment