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
def update_cousin_variants_by_variant_value(variant_value) | |
first_sibling_value = variant_value.category.variant_values.first | |
existing_variants_with_this_value = self.variants.includes(:variant_values).where('variant_value_id = ?', first_sibling_value.id) | |
new_variants = [] | |
existing_variants_with_this_value.each do |variant| | |
new_variant = product.variant.create(price: self.price) | |
variant.variant_values.each do |old_variant_value| | |
if old_variant_value.variant_category != variant_value.variant_category | |
new_variant.variant_values << old_variant_value |
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
def cleanup_variants | |
self.variants.each do |variant| | |
variant.variant_values.delete(self) | |
variant.destroy if variant.variant_values.count == 0 | |
end | |
end |
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
%input{ :name => "page_url", | |
:type => "text", | |
:placeholder => "http://YourProductSite.com", | |
:maxlength => 200, | |
:"ng-model" => "product_advanced.page_url", | |
:"ng-disabled" => "!product_advanced.has_landing_page", | |
:"ng-change" => "change(product_advanced)", | |
:"ng-required" => "product_advanced.has_landing_page", | |
:"enforce-uri-scheme" => "" } |
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
scope.states = (filter gon.states, country_id: scope.taxRate.country_id) | |
scope.states = state for state in gon.states when state.country_id is scope.taxRate.country_id |
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
Started PUT "/orders/161c9a7d55d" for 127.0.0.1 at 2013-05-06 21:11:33 -0400 | |
Processing by OrdersController#update as */* | |
Parameters: {"order"=>{"line_items_attributes"=>{"0"=>{"id"=>"455", "quantity"=>"2", "variant_id"=>"173"}}}, "id"=>"161c9a7d55d"} | |
Order Load (0.4ms) SELECT "orders".* FROM "orders" WHERE "orders"."token" = '161c9a7d55d' LIMIT 1 | |
(0.1ms) BEGIN | |
LineItem Load (0.2ms) SELECT "line_items".* FROM "line_items" WHERE "line_items"."order_id" = 216 AND "line_items"."id" IN (455) | |
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = 4 LIMIT 1 | |
Product Load (0.5ms) SELECT "products".* FROM "products" WHERE "products"."id" = 9 LIMIT 1 | |
CACHE (0.0ms) SELECT "products".* FROM "products" WHERE "products"."id" = 9 LIMIT 1 | |
Image Load (0.2ms) SELECT "images".* FROM "images" WHERE "images"."product_id" = 9 ORDER BY ordering ASC |
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
attr_accessible :one, :two, :three, :four, :five, :six, :seven, :eight, :nine, :ten, :eleven, | |
:twelve, :thirteen, :fourteen, :fifteen |
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
attr_accessible :one, | |
:two, | |
:three, | |
:four, | |
:five, | |
:six, | |
:seven, | |
:eight, | |
:nine, | |
:ten, |
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
#!/bin/bash | |
is_project_id() | |
{ | |
project_ids=(BLOG OPS SYS IT PS PUB SS LP EX UBWEB) | |
found=0 | |
for id in "${project_ids}"; do | |
if [[ $id == $1 ]]; then | |
found=1 |
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
" Strip trailing whitespace | |
function! <SID>StripTrailingWhitespaces() | |
" Preparation: save last search, and cursor position. | |
let _s=@/ | |
let l = line(".") | |
let c = col(".") | |
" Do the business: | |
%s/\s\+$//e | |
" Clean up: restore previous search history, and cursor position | |
let @/=_s |
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
Show hidden characters
{ | |
"eqeqeq": true, | |
"latedef": true, | |
"noarg": true, | |
"nonew": true, | |
"quotmark": true, | |
"undef": true, | |
"unused": true, | |
"trailing": true, | |
"maxdepth": 3, |