Class: ListsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ListsController
- Defined in:
- app/controllers/lists_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /lists —————————————————————————-.
-
#destroy ⇒ Object
DELETE /lists/1 —————————————————————————-.
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
POST /lists
6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/lists_controller.rb', line 6 def create # Find any existing list with the same name (case insensitive) if @list = List.find(:first, :conditions => ["lower(name) = ?", params[:list][:name].downcase]) @list.update_attributes(params[:list]) else @list = List.create(params[:list]) end respond_with(@list) end |
#destroy ⇒ Object
DELETE /lists/1
18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/lists_controller.rb', line 18 def destroy @list = List.find(params[:id]) @list.destroy respond_with(@list) rescue ActiveRecord::RecordNotFound respond_to_not_found(:html, :js, :json, :xml) end |