Skip to content

Instantly share code, notes, and snippets.

@tmking
Created August 14, 2009 00:02
Show Gist options
  • Save tmking/167529 to your computer and use it in GitHub Desktop.
Save tmking/167529 to your computer and use it in GitHub Desktop.
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
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