Skip to content

Instantly share code, notes, and snippets.

# renders nothing
<div data-hook="product_show">
<<h1>Hello World</h1>
</div>
# renders correctly
<div data-hook="product_show">
<% @body_id = 'product-details' %>
<h1>Hello World</h1>
</div>
# renders nothing
<div data-hook="product_show">
<h1>Hello World</h1>
</div>
# renders correctly
<div data-hook="product_show">
<% @body_id = 'product-details' %>
<h1>Hello World</h1>
</div>
Started GET "/products/toughbook-19" for 127.0.0.1 at 2011-11-04 13:20:12 -0400
Processing by ProductsController#show as HTML
Parameters: {"id"=>"toughbook-19"}
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Product Load (0.2ms) SELECT "products".* FROM "products" WHERE "products"."permalink" = 'toughbook-19' LIMIT 1
Variant Load (0.2ms) SELECT "variants".* FROM "variants" WHERE "variants"."product_id" = 1 AND (variants.deleted_at is null)
SQL (0.2ms) SELECT "option_values".*, "t0"."variant_id" AS ar_association_key_name FROM "option_values" INNER JOIN "option_values_variants" "t0" ON "option_values"."id" = "t0"."option_value_id" WHERE "t0"."variant_id" IN (1)
Image Load (0.3ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Image') AND "assets"."viewable_type" = 'Variant' AND "assets"."viewable_id" IN (1) ORDER BY position
Deface: 1 overrides found for 'pr
Started GET "/products/toughbook-19" for 127.0.0.1 at 2011-11-04 13:26:59 -0400
Processing by ProductsController#show as HTML
Parameters: {"id"=>"toughbook-19"}
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Product Load (0.2ms) SELECT "products".* FROM "products" WHERE "products"."permalink" = 'toughbook-19' LIMIT 1
Variant Load (0.2ms) SELECT "variants".* FROM "variants" WHERE "variants"."product_id" = 1 AND (variants.deleted_at is null)
SQL (0.2ms) SELECT "option_values".*, "t0"."variant_id" AS ar_association_key_name FROM "option_values" INNER JOIN "option_values_variants" "t0" ON "option_values"."id" = "t0"."option_value_id" WHERE "t0"."variant_id" IN (1)
Image Load (0.3ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Image') AND "assets"."viewable_type" = 'Variant' AND "assets"."viewable_id" IN (1) ORDER BY position
Deface: 1 overrides found
Started GET "/products/toughbook-19" for 127.0.0.1 at 2011-11-04 13:31:42 -0400
Processing by ProductsController#show as HTML
Parameters: {"id"=>"toughbook-19"}
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Product Load (0.3ms) SELECT "products".* FROM "products" WHERE "products"."permalink" = 'toughbook-19' LIMIT 1
Variant Load (0.2ms) SELECT "variants".* FROM "variants" WHERE "variants"."product_id" = 1 AND (variants.deleted_at is null)
SQL (0.3ms) SELECT "option_values".*, "t0"."variant_id" AS ar_association_key_name FROM "option_values" INNER JOIN "option_values_variants" "t0" ON "option_values"."id" = "t0"."option_value_id" WHERE "t0"."variant_id" IN (1)
Image Load (0.3ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Image') AND "assets"."viewable_type" = 'Variant' AND "assets"."viewable_id" IN (1) ORDER BY position
Deface: 1 overrides found for 'products/show'
Deface: 'promo_product_properties' matched 0 times with '[data-hook='product_pr
def option_values
option_values = []
model.variants.each do |variant|
option_values << variant.option_values
end
option_values.flatten.uniq
end
class ProductDecorator < ApplicationDecorator
decorates :product
# Gets all of the OptionValues that is used by a Variant of the Product
#
# Returns an Array of OptionValues
def option_values
option_values = []
model.variants.each do |variant|
class Human
constructor: -> @isHungry = true
eat: ->
@isHungry = false
console.log "NUM NUMS!"
class Girl extends Human
wine: -> console.log "You never buy me flowers!"
sue = new Girl()
class Human
constructor: -> @isHungry = true
eat: ->
@isHungry = false
console.log "NUM NUMS!"
class Girl extends Human
wine: -> console.log "You never buy me flowers!"
jessica = new Girl()
= form_tag product_path(@product), :method => 'get', :id => "variants_search", :remote => true do