1 class EntriesController < ApplicationController
5 @entries = Entry.find(:all)
8 format.html # index.html.erb
9 format.xml { render :xml => @entries }
16 @entry = Entry.find(params[:id])
18 respond_to do |format|
19 format.html # show.html.erb
20 format.xml { render :xml => @entry }
25 # GET /entries/new.xml
29 respond_to do |format|
30 format.html # new.html.erb
31 format.xml { render :xml => @entry }
37 @entry = Entry.find(params[:id])
43 @entry = Entry.new(params[:entry])
45 respond_to do |format|
47 flash[:notice] = 'Entry was successfully created.'
48 format.html { redirect_to(@entry) }
49 format.xml { render :xml => @entry, :status => :created, :location => @entry }
51 format.html { render :action => "new" }
52 format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }
60 @entry = Entry.find(params[:id])
62 respond_to do |format|
63 if @entry.update_attributes(params[:entry])
64 flash[:notice] = 'Entry was successfully updated.'
65 format.html { redirect_to(@entry) }
66 format.xml { head :ok }
68 format.html { render :action => "edit" }
69 format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }
75 # DELETE /entries/1.xml
77 @entry = Entry.find(params[:id])
80 respond_to do |format|
81 format.html { redirect_to(entries_url) }
82 format.xml { head :ok }