class MenusController < ApplicationController
  skip_before_filter :authenticate_user!

  def index
    #@menu = Menu.all
    redirect_to menu_path(1)
  end

  def show
    @menus = Menu.all
    @menu = @menus.find(params[:id])
    categories = {}
    fods = @menu.foods
    fods.each do |fod|
      food_categories = fod.categories.map(&:title)
      food_categories.each do |food_category|
        if not categories[food_category]
          categories[food_category] = []
        end
        categories[food_category] << fod
      end
    end
    @foods = categories
    if @menu.style == 1
      render 'show'
    else
      render 'text'
    end
  end

end
