Class: Peoplefinder::PeopleController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Peoplefinder::PeopleController
- Defined in:
- app/controllers/peoplefinder/people_controller.rb
Instance Method Summary collapse
- #add_membership ⇒ Object
-
#create ⇒ Object
POST /people.
-
#destroy ⇒ Object
DELETE /people/1.
-
#edit ⇒ Object
GET /people/1/edit.
-
#index ⇒ Object
GET /people.
-
#new ⇒ Object
GET /people/new.
-
#show ⇒ Object
GET /people/1.
-
#update ⇒ Object
PATCH/PUT /people/1.
Instance Method Details
#add_membership ⇒ Object
61 62 63 64 65 |
# File 'app/controllers/peoplefinder/people_controller.rb', line 61 def add_membership set_person if params[:id].present? @person ||= Person.new render 'add_membership', layout: false end |
#create ⇒ Object
POST /people
29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/peoplefinder/people_controller.rb', line 29 def create @person = Person.new(person_params) if @person.valid? confirm_or_create else error :create_error render :new end end |
#destroy ⇒ Object
DELETE /people/1
54 55 56 57 58 59 |
# File 'app/controllers/peoplefinder/people_controller.rb', line 54 def destroy @person.send_destroy_email!(current_user) @person.destroy notice :profile_deleted, person: @person redirect_to home_path end |
#edit ⇒ Object
GET /people/1/edit
24 25 26 |
# File 'app/controllers/peoplefinder/people_controller.rb', line 24 def edit @person.memberships.build if @person.memberships.empty? end |
#index ⇒ Object
GET /people
9 10 11 |
# File 'app/controllers/peoplefinder/people_controller.rb', line 9 def index redirect_to '/' end |
#new ⇒ Object
GET /people/new
18 19 20 21 |
# File 'app/controllers/peoplefinder/people_controller.rb', line 18 def new @person = Person.new @person.memberships.build group: group_from_group_id end |
#show ⇒ Object
GET /people/1
14 15 |
# File 'app/controllers/peoplefinder/people_controller.rb', line 14 def show end |
#update ⇒ Object
PATCH/PUT /people/1
41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/peoplefinder/people_controller.rb', line 41 def update @old_email = @person.email @person.assign_attributes(person_params) if @person.valid? confirm_or_update else error :update_error render :edit end end |