Skip to content

Instantly share code, notes, and snippets.

@Solnse
Created November 7, 2011 09:15
Show Gist options
  • Save Solnse/1344522 to your computer and use it in GitHub Desktop.
Save Solnse/1344522 to your computer and use it in GitHub Desktop.
= render :partial => 'menu_header'
.menus
= @foods.each do |category, foods|
= category
- foods.each do |foods|
- if foods.img_url?
.list_image
= link_to image_tag(foods.img_url, class: 'list_image'), asset_path(foods.img_url), target: 'new'
%h3= foods.name
.list_description
= sanitize(foods.description)
.price_line
%span.price= number_to_currency(foods.price)
class MenusController < ApplicationController
skip_before_filter :authorize
# GET /menus
# GET /menus.json
def index
@foods = FoodItem.find(:all).group_by { |food| food.category }
@food_items = FoodItem.all
@menus = Menu.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @menus }
end
end
...
@Solnse
Copy link
Author

Solnse commented Nov 7, 2011

renders everything perfectly.... but after the yield, it dumps the whole recordset again.

http://mavericksaloon.herokuapp.com/menus?locale=en

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment