diff options
| author | hukl <contact@smyck.org> | 2009-08-09 11:57:44 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-08-09 11:57:44 +0200 |
| commit | 9b4d055b649ad24ad1482f72d138aa73da1e4bd7 (patch) | |
| tree | fa97f1877332fe05d1eb752c7ac63dce44edc32d /app/controllers/menu_items_controller.rb | |
| parent | 550d9c1790b202175076894bf82d202bc32db5b6 (diff) | |
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.
Diffstat (limited to 'app/controllers/menu_items_controller.rb')
| -rw-r--r-- | app/controllers/menu_items_controller.rb | 15 |
1 files changed, 5 insertions, 10 deletions
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 | |||
| 10 | end | 10 | end |
| 11 | 11 | ||
| 12 | def new | 12 | def new |
| 13 | @menu_item = MenuItem.new params[:menu_item] | ||
| 13 | end | 14 | end |
| 14 | 15 | ||
| 15 | def create | 16 | def create |
| 16 | respond_to do |format| | 17 | if MenuItem.create( params[:menu_item] ) |
| 17 | format.html {} | 18 | redirect_to menu_items_path |
| 18 | 19 | else | |
| 19 | format.js do | 20 | render :new |
| 20 | MenuItem.create params[:menu_item] | ||
| 21 | end | ||
| 22 | |||
| 23 | |||
| 24 | end | 21 | end |
| 25 | |||
| 26 | |||
| 27 | end | 22 | end |
| 28 | 23 | ||
| 29 | def edit | 24 | def edit |
