From 9b4d055b649ad24ad1482f72d138aa73da1e4bd7 Mon Sep 17 00:00:00 2001 From: hukl Date: Sun, 9 Aug 2009 11:57:44 +0200 Subject: refactored the way new menu items are created. went back to rest and added the js ajax search to fill out the form for you. much cleaner, unobtrusive approach. --- app/controllers/menu_items_controller.rb | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'app/controllers/menu_items_controller.rb') diff --git a/app/controllers/menu_items_controller.rb b/app/controllers/menu_items_controller.rb index d6f0252..0ba56c3 100644 --- a/app/controllers/menu_items_controller.rb +++ b/app/controllers/menu_items_controller.rb @@ -10,20 +10,15 @@ class MenuItemsController < ApplicationController end def new + @menu_item = MenuItem.new params[:menu_item] end def create - respond_to do |format| - format.html {} - - format.js do - MenuItem.create params[:menu_item] - end - - + if MenuItem.create( params[:menu_item] ) + redirect_to menu_items_path + else + render :new end - - end def edit -- cgit v1.3