Class: Phcmemberspro::Members::ContactsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/phcmemberspro/members/contacts_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_account, #scoped_to

Instance Method Details

#createObject

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().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

#destroyObject

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

#editObject

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().find(params[:id])
end

#indexObject

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_contact = main.contacts.scoped_to().order('mccontactname ASC')
end

#newObject

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().build
  respond_to do |format|
    format.html # new.html.erb
    format.xml  { render :xml => @members_contact }
  end
end

#phc_member_mains_infoObject



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

#showObject

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().find(params[:id])
end

#updateObject

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