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.
- #phc_member_mains_info ⇒ Object
-
#show ⇒ Object
Detailed Member Contact Information.
-
#update ⇒ Object
Update Action.
Methods inherited from ApplicationController
#current_account, #phcmemberspro_membersmain_layouts_resolver, #scoped_to
Instance Method Details
#create ⇒ Object
Create Action
47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/phcmemberspro/members/contacts_controller.rb', line 47 def create @main = Members::Main.find(params[:main_id]) @members_contact = @main.contacts.scoped_to(current_account).create(members_contact_params) 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
67 68 69 70 71 72 |
# File 'app/controllers/phcmemberspro/members/contacts_controller.rb', line 67 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
41 42 43 44 |
# File 'app/controllers/phcmemberspro/members/contacts_controller.rb', line 41 def edit main = Members::Main.find(params[:main_id]) @members_contact = main.contacts.scoped_to(current_account).find(params[:id]) end |
#index ⇒ Object
Member Contact Index
19 20 21 22 |
# File 'app/controllers/phcmemberspro/members/contacts_controller.rb', line 19 def index main = Members::Main.find(params[:main_id]) @members_contacts = main.contacts.scoped_to(current_account).order('mcprovince ASC') end |
#new ⇒ Object
New Contact
31 32 33 34 35 36 37 38 |
# File 'app/controllers/phcmemberspro/members/contacts_controller.rb', line 31 def new main = Members::Main.find(params[:main_id]) @members_contact = main.contacts.scoped_to(current_account).build respond_to do |format| format.html # new.html.erb format.xml { render :xml => @members_contact } end end |
#phc_member_mains_info ⇒ Object
14 15 16 |
# File 'app/controllers/phcmemberspro/members/contacts_controller.rb', line 14 def phc_member_mains_info @members_main = Members::Main.find(params[:main_id]) end |
#show ⇒ Object
Detailed Member Contact Information
25 26 27 28 |
# File 'app/controllers/phcmemberspro/members/contacts_controller.rb', line 25 def show main = Members::Main.find(params[:main_id]) @members_contact = main.contacts.scoped_to(current_account).find(params[:id]) end |
#update ⇒ Object
Update Action
58 59 60 61 62 63 64 |
# File 'app/controllers/phcmemberspro/members/contacts_controller.rb', line 58 def update 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 |