Class: CalendarsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/app/controllers/calendars_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

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

#destroyObject

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

#editObject

GET /calendars/1/edit



37
38
39
# File 'lib/app/controllers/calendars_controller.rb', line 37

def edit
  @calendar = Calendar.find(params[:id])
end

#indexObject

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

#newObject

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

#showObject

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

#updateObject

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