| Class | TasksController |
| In: |
app/controllers/tasks_controller.rb
|
| Parent: | ApplicationController |
POST /tasks POST /tasks.xml
# File app/controllers/tasks_controller.rb, line 44
44: def create
45: @task = Task.new(params[:task])
46:
47: respond_to do |format|
48: if @task.save
49: flash[:notice] = 'Task was successfully created.'
50: format.html { redirect_to(@task) }
51: format.xml { render :xml => @task, :status => :created, :location => @task }
52: else
53: format.html { render :action => "new" }
54: format.xml { render :xml => @task.errors, :status => :unprocessable_entity }
55: end
56: end
57: end
DELETE /tasks/1 DELETE /tasks/1.xml
# File app/controllers/tasks_controller.rb, line 85
85: def destroy
86: @task = Task.find(params[:id])
87: @task.destroy
88:
89: respond_to do |format|
90: format.html { redirect_to(tasks_url) }
91: format.xml { head :ok }
92: end
93: end
GET /tasks/1/edit
# File app/controllers/tasks_controller.rb, line 38
38: def edit
39: @task = Task.find(params[:id])
40: end
GET /tasks GET /tasks.xml
# File app/controllers/tasks_controller.rb, line 4
4: def index
5: @tasks = Task.ordered
6:
7: respond_to do |format|
8: format.html # index.html.erb
9: format.xml { render :xml => @tasks }
10: format.atom
11: format.json { render :json => @tasks, :callback => 'show' }
12: end
13: end
GET /tasks/new GET /tasks/new.xml
# File app/controllers/tasks_controller.rb, line 28
28: def new
29: @task = Task.new
30:
31: respond_to do |format|
32: format.html # new.html.erb
33: format.xml { render :xml => @task }
34: end
35: end
GET /tasks/1 GET /tasks/1.xml
# File app/controllers/tasks_controller.rb, line 17
17: def show
18: @task = Task.find(params[:id])
19:
20: respond_to do |format|
21: format.html # show.html.erb
22: format.xml { render :xml => @task }
23: end
24: end
PUT /tasks/1 PUT /tasks/1.xml
# File app/controllers/tasks_controller.rb, line 61
61: def update
62: @task = Task.find(params[:id])
63:
64: respond_to do |format|
65: if @task.update_attributes(params[:task])
66: flash[:notice] = 'Task was successfully updated.'
67: format.html { redirect_to(@task) }
68: format.xml { head :ok }
69: format.js do
70: render(:update) do |page|
71: page.replace_html dom_id(@task), :partial => 'task'
72: page.visual_effect :highlight, dom_id(@task)
73: end
74: end
75: else
76: format.html { render :action => "edit" }
77: format.xml { render :xml => @task.errors, :status => :unprocessable_entity }
78: format.js { render :text => "alert('Error!')" }
79: end
80: end
81: end