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
class UsernameBadgeComponent < ActionView::Component::Base | |
include ActionView::Component::Live::Subscriber | |
listen_to :user | |
def initialize(user:) | |
@user = user | |
end | |
def name |
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
class User < ApplicationRecord | |
include ActionView::Component::Live::Broadcaster | |
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
<div data-controller="live" data-live-component="UsernameBadgeComponent" data-live-id="<%= id %>"> | |
<span class="badge badge-primary"><%= name %></span> | |
</div> |
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
Spree::OrderUpdater.class_eval do | |
def recalculate_adjustments | |
# if order does not have adjustment of type "buyersgroup discount" then | |
# create that adjustment on the order | |
adjustments.includes(:source).each { |adjustment| adjustment.update! order } | |
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
Spree::Gateway::AuthorizeNet.class_eval do | |
def capture money, code, gateway_opts | |
provider.capture money, code, gateway_opts | |
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
[GEM_ROOT]/gems/activesupport-4.0.2/lib/active_support/core_ext/kernel/reporting.rb:82:in `capture` | |
[GEM_ROOT]/bundler/gems/spree-2d8bc75d8955/core/app/models/spree/payment/processing.rb:47:in `block in capture!` | |
[GEM_ROOT]/bundler/gems/spree-2d8bc75d8955/core/app/models/spree/payment/processing.rb:179:in `protect_from_connection_error` | |
[GEM_ROOT]/bundler/gems/spree-2d8bc75d8955/core/app/models/spree/payment/processing.rb:38:in `capture!` | |
[GEM_ROOT]/bundler/gems/spree-2d8bc75d8955/backend/app/controllers/spree/admin/payments_controller.rb:57:in `fire` | |
[GEM_ROOT]/gems/actionpack-4.0.2/lib/action_controller/metal/implicit_render.rb:4:in `send_action` | |
[GEM_ROOT]/gems/actionpack-4.0.2/lib/abstract_controller/base.rb:189:in `process_action` | |
[GEM_ROOT]/gems/actionpack-4.0.2/lib/action_controller/metal/rendering.rb:10:in `process_action` | |
[GEM_ROOT]/gems/actionpack-4.0.2/lib/abstract_controller/callbacks.rb:18:in `block in process_action` | |
[GEM_ROOT]/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:493:in `_ru |
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
Spree::Order.state_machine.before_transition :to => :payment, :do => :valid_shipping? | |
Spree::Order.class_eval do | |
def valid_shipping? | |
self.shipment.shipping_rates.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
namespace :import do | |
task :stuff => :environment do | |
require 'nokogiri' | |
taxonomy = Spree::Taxonomy.create!(:name => "Categories") | |
xref = Hash.new | |
category_xref = Nokogiri::HTML(open('public/u6Dn_vm_category_xref.xml')) | |
category_xref.encoding = 'utf-8' | |
category_xref.xpath('//database/table_data/row').each do |node| | |
xref[node.at('field[@name="category_child_id"]').text.to_i] = node.at('field[@name="category_parent_id"]').text.to_i |