app/controllers/phcmemberspro/member/profiles_controller.rb in phcmemberspro-32.0.0 vs app/controllers/phcmemberspro/member/profiles_controller.rb in phcmemberspro-33.0.0
- old
+ new
@@ -2,12 +2,11 @@
module Phcmemberspro
class Member::ProfilesController < ApplicationController
# Security & Action Filters
- before_action :require_user
- before_action :authrocket_membership_info
+ before_action :authenticate_user!
before_action :set_paper_trail_whodunnit
before_action :set_member_profile, only: [:show, :edit, :update, :destroy]
# INDEX - Member Profile
def index
@@ -20,10 +19,12 @@
@member_profile_versions = Phcmemberspro::ProfileVersions.where(item_id: @member_profile, item_type: 'Phcmemberspro::Member::Profile')
end
# NEW FORM - Member Profile
def new
+ @member_profile.user_id = current_user.id
+ @member_profile.org_id = current_user.org_id
@member_profile = Member::Profile.new
end
# EDIT FORM - Member Profile
def edit
@@ -31,25 +32,21 @@
# POST - Member Profile
def create
@member_profile = Member::Profile.new(member_profile_params)
@member_profile.user_id = current_user.id
- @member_profile.user_name = current_user.username
- @member_profile.membership_id = authrocket_membership_info.id
- @member_profile.oganization_id = authrocket_membership_info.org_id
+ @member_profile.org_id = current_user.org_id
if @member_profile.save
redirect_to member_profiles_url, notice: 'Profile was successfully created.'
else
render :new
end
end
# PATCH/PUT - Member Profile
def update
@member_profile.user_id = current_user.id
- @member_profile.user_name = current_user.username
- @member_profile.membership_id = authrocket_membership_info.id
- @member_profile.oganization_id = authrocket_membership_info.org_id
+ @member_profile.org_id = current_user.org_id
if @member_profile.update(member_profile_params)
redirect_to member_profiles_url, notice: 'Profile was successfully updated.'
else
render :edit
end