Skip to content

Instantly share code, notes, and snippets.

@tomlea
Created January 18, 2010 12:09
Show Gist options
  • Save tomlea/279962 to your computer and use it in GitHub Desktop.
Save tomlea/279962 to your computer and use it in GitHub Desktop.
def sort_order
# Google was indexing "random" search orders, it parsed our javascript, badly.
SORT_METHODS[params[:sort_order]] or raise_redirect_to(@product, :status => 301)
end
def segment
segment = params[:segment]
segment = segment.to_sym if %w[all other].include?(segment)
segment = nil if segment == :all
# Bad or expired segments need 301ing
raise_redirect_to(@product, :status => 301) if segment === String and [email protected]?(segment)
segment
end
def show
@product.reviews.for_segment(segment).order_by(sort_order)
end
def show_extended_detail
@product.reviews.for_segment(segment).order_by(sort_order)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment