-
-
Save tcocca/1355390 to your computer and use it in GitHub Desktop.
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
ProductsController.class_eval do | |
respond_to :html, :js | |
def show | |
product_source = Product.find_by_permalink!(params[:id]) | |
@product = ProductDecorator.new(product_source) | |
return unless @product | |
if params[:option_values] | |
option_values_ids = [ | |
params[:option_values][:cpu].to_i, | |
params[:option_values][:screen].to_i | |
] | |
end | |
@variants = @product.find_variants(option_values_ids) | |
@product_properties = ProductProperty.includes(:property).where(:product_id => @product.id) | |
@selected_variant = @variants.detect { |v| v.available? } | |
referer = request.env['HTTP_REFERER'] | |
if referer && referer.match(HTTP_REFERER_REGEXP) | |
@taxon = Taxon.find_by_permalink($1) | |
end | |
respond_with(@product) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment