Class: CalendarsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- CalendarsController
- Defined in:
- lib/app/controllers/calendars_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /calendars POST /calendars.xml.
-
#destroy ⇒ Object
DELETE /calendars/1 DELETE /calendars/1.xml.
-
#edit ⇒ Object
GET /calendars/1/edit.
-
#index ⇒ Object
GET /calendars GET /calendars.xml.
-
#new ⇒ Object
GET /calendars/new GET /calendars/new.xml.
-
#show ⇒ Object
GET /calendars/1 GET /calendars/1.xml.
-
#update ⇒ Object
PUT /calendars/1 PUT /calendars/1.xml.
Instance Method Details
#create ⇒ Object
POST /calendars POST /calendars.xml
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/app/controllers/calendars_controller.rb', line 43 def create @calendar = Calendar.new(params[:calendar]) respond_to do |format| if @calendar.save format.html { redirect_to(@calendar, :notice => 'Dummy resource was successfully created.') } format.xml { render :xml => @calendar, :status => :created, :location => @calendar } else format.html { render :action => "new" } format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /calendars/1 DELETE /calendars/1.xml
75 76 77 78 79 80 81 82 83 |
# File 'lib/app/controllers/calendars_controller.rb', line 75 def destroy @calendar = Calendar.find(params[:id]) @calendar.destroy respond_to do |format| format.html { redirect_to(calendars_url) } format.xml { head :ok } end end |
#edit ⇒ Object
GET /calendars/1/edit
37 38 39 |
# File 'lib/app/controllers/calendars_controller.rb', line 37 def edit @calendar = Calendar.find(params[:id]) end |
#index ⇒ Object
GET /calendars GET /calendars.xml
5 6 7 8 9 10 11 |
# File 'lib/app/controllers/calendars_controller.rb', line 5 def index respond_with(@calendars = Calendar.all) # respond_to do |format| # format.html # index.html.erb # format.xml { render :xml => @calendars } # end end |
#new ⇒ Object
GET /calendars/new GET /calendars/new.xml
27 28 29 30 31 32 33 34 |
# File 'lib/app/controllers/calendars_controller.rb', line 27 def new @calendar = Calendar.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @calendar } end end |
#show ⇒ Object
GET /calendars/1 GET /calendars/1.xml
15 16 17 18 19 20 21 22 23 |
# File 'lib/app/controllers/calendars_controller.rb', line 15 def show respond_with(@calendar = Calendar.find(params[:id])) =begin respond_to do |format| format.html # show.html.erb format.xml { render :xml => @calendar } end =end end |
#update ⇒ Object
PUT /calendars/1 PUT /calendars/1.xml
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/app/controllers/calendars_controller.rb', line 59 def update @calendar = Calendar.find(params[:id]) respond_to do |format| if @calendar.update_attributes(params[:calendar]) format.html { redirect_to(@calendar, :notice => 'Dummy resource was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity } end end end |