Skip to content

Instantly share code, notes, and snippets.

@bofrede
Created March 23, 2017 13:34
Show Gist options
  • Save bofrede/1f353e23b58eb6df90601eaad532b450 to your computer and use it in GitHub Desktop.
Save bofrede/1f353e23b58eb6df90601eaad532b450 to your computer and use it in GitHub Desktop.
Fixes for Solidus with Solidus Globalize
require 'spree/product'
require 'solidus_globalize/fallbacks'
module Spree
Product.class_eval do
# Fix for method not found find_by_slug
def self.find_by_slug(slug)
translation = Product::Translation.find_by_slug(slug)
find(translation.spree_product_id)
end
end
Taxon.class_eval do
# Fix for method not found find_by_permalink!
def self.find_by_permalink!(permalink)
translation = Spree::Taxon::Translation.find_by_permalink!(permalink)
find(translation.spree_taxon_id)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment