Last active
December 20, 2015 20:59
-
-
Save jgrannas/6194740 to your computer and use it in GitHub Desktop.
Revisions
-
jgrannas revised this gist
Aug 9, 2013 . 1 changed file with 12 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,4 +8,15 @@ def self.filter_with_params(params) end end scoped end Started GET "/styles?utf8=%E2%9C%93&t%5B%5D=engagement&t%5B%5D=Halo" for 127.0.0.1 at 2013-08-09 11:58:46 -0400 Processing by StylesController#index as JSON Parameters: {"utf8"=>"✓", "t"=>["engagement", "Halo"]} [1m[35mUser Load (0.3ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 [1m[36m (0.4ms)[0m [1mSELECT COUNT(*) FROM "roles" INNER JOIN "users_roles" ON "roles"."id" = "users_roles"."role_id" WHERE "users_roles"."user_id" = 1 AND (((roles.name = 'admin') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL)))[0m [1m[35mCollection Load (0.3ms)[0m SELECT "collections".* FROM "collections" [1m[36mSQL (0.4ms)[0m [1mSELECT "styles"."id" AS t0_r0, "styles"."collection_id" AS t0_r1, "styles"."item_number" AS t0_r2, "styles"."name" AS t0_r3, "styles"."title" AS t0_r4, "styles"."description" AS t0_r5, "styles"."slug" AS t0_r6, "styles"."content" AS t0_r7, "styles"."created_at" AS t0_r8, "styles"."updated_at" AS t0_r9, "styles"."price" AS t0_r10, "styles"."data" AS t0_r11, "styles"."meta_title" AS t0_r12, "styles"."meta_desc" AS t0_r13, "styles"."active" AS t0_r14, "tags"."id" AS t1_r0, "tags"."name" AS t1_r1, "tags"."created_at" AS t1_r2, "tags"."updated_at" AS t1_r3, "tags"."tag_category_id" AS t1_r4 FROM "styles" LEFT OUTER JOIN "tagizations" ON "tagizations"."style_id" = "styles"."id" LEFT OUTER JOIN "tags" ON "tags"."id" = "tagizations"."tag_id" WHERE "tags"."name" = 'engagement' AND "tags"."name" = 'Halo' AND (styles.name != '')[0m Completed 200 OK in 22ms (Views: 0.1ms | ActiveRecord: 1.4ms) -
jgrannas renamed this gist
Aug 9, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
jgrannas created this gist
Aug 9, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ def self.filter_with_params(params) scoped = self.where("styles.name != ''") scoped = scoped.includes(:tags)#, :collection) #params[:t].inject(scoped){|memo, val| memo.where(:tags => {:name => val})} if params[:t] if params[:t] params[:t].each do |t| scoped = scoped.where(:tags => {:name => t}) end end scoped end