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