Created
August 14, 2009 00:02
-
-
Save tmking/167529 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
def list_old | |
@brand = params[:brand] | |
@group = params[:group] | |
@title = "#{@brand.capitalize} #{@group.capitalize}" | |
case @brand | |
when 'usedsteinway': | |
@title = "Pre-Owned & Refurbished Steinway #{@group.capitalize}" | |
@products = Product.stats.brand('steinway').group(@group).used.price | |
when 'cristofori': | |
@products = Product.stats.group(@group).brand('CR').not_used.price | |
when 'roland': | |
case @group | |
when 'grands': | |
@products = Product.stats.brand(@brand).digital_grand.not_used.price | |
else | |
@products = Product.stats.brand(@brand).digitals.not_used.not_digital_grand.price | |
end | |
else | |
case @group | |
when 'digitals': | |
@products = Product.stats.brand(@brand).digitals.not_used.price | |
when 'players': | |
@products = Product.stats.brand(@brand).not_used.dap.price | |
else | |
@products = Product.stats.group(@group).brand(@brand).not_used.not_dap.price | |
end | |
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
def list | |
render :template => 'product/list' | |
end | |
def select_by_group | |
case params[:group] | |
when 'digitals': | |
@products = Product.stats.brand(params[:action]).digitals.not_used.price | |
list | |
when 'players': | |
@products = Product.stats.brand(params[:action]).not_used.dap.price | |
list | |
end | |
end | |
def default_select | |
@products = Product.stats.brand(params[:action]).group(params[:group]).not_used.not_dap.price | |
list | |
end | |
def yamaha | |
select_by_group || default_select | |
end | |
def steinway | |
self.yamaha | |
end | |
def usedsteinway | |
@title = "Pre-Owned & Refurbished Steinway" | |
select_by_group || @products = Product.stats.brand('steinway').group(params[:group]).used.price | |
list | |
end | |
def cristofori | |
@title = 'Cristofori' | |
params[:action] = 'CR' | |
self.yamaha | |
end | |
def roland | |
if params[:group] == 'grands' | |
@products = Product.stats.brand(params[:action]).digital_grand.not_used.price | |
else | |
@products = Product.stats.brand(params[:action]).digitals.not_used.not_digital_grand.price | |
end | |
list | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment