Skip to content

Instantly share code, notes, and snippets.

Created August 10, 2011 14:31
Show Gist options
  • Save anonymous/1136918 to your computer and use it in GitHub Desktop.
Save anonymous/1136918 to your computer and use it in GitHub Desktop.
Epic oneliner
get '/6b/:product_id/*' do
Product.newest(params['product_id']).to_a.map { |p| [ p, Product.where(Hash[params[:splat].first.split('/').map { |f| [ f.to_sym, (p.send f.to_sym) ] } ] ) ] }.show
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment