Class: Phcmemberspro::Member::ProfilesController

Inherits:
ApplicationController show all
Includes:
Phccorehelpers::PhcpluginsproHelper
Defined in:
app/controllers/phcmemberspro/member/profiles_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#user_for_paper_trail

Instance Method Details

#createObject

CREATE



34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/phcmemberspro/member/profiles_controller.rb', line 34

def create
  @member_profile = Member::Profile.new(member_profile_params)
  @member_profile.user_id = current_user.id
  @member_profile.org_id = current_user.org_id
  if @member_profile.save
    redirect_to member_profiles_url, :flash => { :success => 'Profile was successfully created.' }
  else
    render :new
  end
end

#destroyObject

DELETE



55
56
57
58
# File 'app/controllers/phcmemberspro/member/profiles_controller.rb', line 55

def destroy
  @member_profile.destroy
  redirect_to member_profiles_url, :flash => { :error => 'Profile was successfully destroyed.' }
end

#editObject

EDIT



30
31
# File 'app/controllers/phcmemberspro/member/profiles_controller.rb', line 30

def edit
end

#indexObject

INDEX



14
15
16
# File 'app/controllers/phcmemberspro/member/profiles_controller.rb', line 14

def index
  @member_profiles = Member::Profile.where(org_id: current_user.org_id)
end

#newObject

NEW



25
26
27
# File 'app/controllers/phcmemberspro/member/profiles_controller.rb', line 25

def new
  @member_profile = Member::Profile.new
end

#showObject

SHOW



19
20
21
22
# File 'app/controllers/phcmemberspro/member/profiles_controller.rb', line 19

def show
  @member_profile = Member::Profile.find(params[:id])
  @member_profile_versions = Phcmemberspro::ProfileVersions.where(item_id: @member_profile, item_type: 'Phcmemberspro::Member::Profile')
end

#updateObject

UPDATE



46
47
48
49
50
51
52
# File 'app/controllers/phcmemberspro/member/profiles_controller.rb', line 46

def update
  if @member_profile.update(member_profile_params)
    redirect_to member_profiles_url, :flash => { :success => 'Profile was successfully updated.' }
  else
    render :edit
  end
end