Class: Phcmemberspro::Members::ContactsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Phcmemberspro::Members::ContactsController
- Defined in:
- app/controllers/phcmemberspro/members/contacts_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
Create Action.
-
#destroy ⇒ Object
Delete Action.
-
#edit ⇒ Object
Edit Contact.
-
#index ⇒ Object
Member Contact Index.
-
#new ⇒ Object
New Contact.
-
#show ⇒ Object
Detailed Member Contact Information.
-
#update ⇒ Object
Update Action.
Methods inherited from ApplicationController
#new_login_url, #phcmemberspro_membersmain_layouts_resolver, #require_user
Instance Method Details
#create ⇒ Object
Create Action
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/phcmemberspro/members/contacts_controller.rb', line 42 def create @main = Members::Main.find(params[:main_id]) @members_contact = @main.contacts.create(members_contact_params) @members_contact.user_id = current_user.id @members_contact.membership_id = membership_info.id @members_contact.oganization_id = membership_info.org_id if @members_contact.save redirect_to members_main_contacts_path, notice: 'Member contact information was successfully created.' else render :new end end |
#destroy ⇒ Object
Delete Action
68 69 70 71 72 73 |
# File 'app/controllers/phcmemberspro/members/contacts_controller.rb', line 68 def destroy @main = Members::Main.find(params[:main_id]) @members_contact = @main.contacts.find(params[:id]) @members_contact.destroy redirect_to members_main_contacts_path, notice: 'Member contact information was successfully destroyed.' end |
#edit ⇒ Object
Edit Contact
36 37 38 39 |
# File 'app/controllers/phcmemberspro/members/contacts_controller.rb', line 36 def edit main = Members::Main.find(params[:main_id]) @members_contact = main.contacts.find(params[:id]) end |
#index ⇒ Object
Member Contact Index
14 15 16 17 |
# File 'app/controllers/phcmemberspro/members/contacts_controller.rb', line 14 def index main = Members::Main.find(params[:main_id]) @members_contacts = main.contacts.where(oganization_id: membership_info.org_id).order('mcprovince ASC') end |
#new ⇒ Object
New Contact
26 27 28 29 30 31 32 33 |
# File 'app/controllers/phcmemberspro/members/contacts_controller.rb', line 26 def new main = Members::Main.find(params[:main_id]) @members_contact = main.contacts.build respond_to do |format| format.html # new.html.erb format.xml { render :xml => @members_contact } end end |
#show ⇒ Object
Detailed Member Contact Information
20 21 22 23 |
# File 'app/controllers/phcmemberspro/members/contacts_controller.rb', line 20 def show main = Members::Main.find(params[:main_id]) @members_contact = main.contacts.find(params[:id]) end |
#update ⇒ Object
Update Action
56 57 58 59 60 61 62 63 64 65 |
# File 'app/controllers/phcmemberspro/members/contacts_controller.rb', line 56 def update @members_contact.user_id = current_user.id @members_contact.membership_id = membership_info.id @members_contact.oganization_id = membership_info.org_id if @members_contact.update(members_contact_params) redirect_to members_main_contacts_path, notice: 'Member contact information was successfully updated.' else render :edit end end |