Class: RsvpsController

Inherits:
BaseController show all
Defined in:
app/controllers/rsvps_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#advertise, #cache_action?, #css_help, #footer_content, #homepage_features, #plaxo, #rss_site_index, #site_index

Methods included from LocalizedApplication

#get_matching_ui_locale, #get_sorted_langs_from_accept_header, #get_valid_lang_from_accept_header, #set_locale

Methods included from AuthenticatedSystem

#login_by_token, #update_last_seen_at

Instance Method Details

#createObject

POST /rsvps POST /rsvps.xml



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/rsvps_controller.rb', line 24

def create
  @rsvp = @event.rsvps.new(params[:rsvp])
  @rsvp.user = current_user
  respond_to do |format|
    if @rsvp.save
      flash[:notice] = :your_rsvp_was_successfully_created.l
      format.html { redirect_to [@event] }
      format.js
    else
      format.html { render :action => "new" }
      format.js        
    end
  end
end

#destroyObject

DELETE /rsvps/1 DELETE /rsvps/1.xml



55
56
57
58
59
60
61
62
63
# File 'app/controllers/rsvps_controller.rb', line 55

def destroy
  @rsvp.destroy
  respond_to do |format|
    format.html { 
      flash[:notice] = :your_rsvp_has_been_retracted.l
      redirect_to [@event]   
      }
  end
end

#editObject

GET /posts/1;edit



19
20
# File 'app/controllers/rsvps_controller.rb', line 19

def edit
end

#find_eventObject



7
8
9
10
11
# File 'app/controllers/rsvps_controller.rb', line 7

def find_event
  @event = Event.find(params[:event_id])
rescue
  redirect_to events_url
end

#newObject

GET /rsvps/new



14
15
16
# File 'app/controllers/rsvps_controller.rb', line 14

def new
  @rsvp = @event.rsvps.new
end

#updateObject

PUT /rsvps/1 PUT /rsvps/1.xml



41
42
43
44
45
46
47
48
49
50
51
# File 'app/controllers/rsvps_controller.rb', line 41

def update
  @rsvp.attendees_count = params[:rsvp][:attendees_count]
  respond_to do |format|
    if @rsvp.save
      flash[:notice] = :your_rsvp_was_successfully_updated.l
      format.html { redirect_to [@event] }
    else
      format.html { render :action => "edit" }  
    end
  end
end