app/controllers/phcmemberspro/member/profiles_controller.rb in phcmemberspro-87.0.0 vs app/controllers/phcmemberspro/member/profiles_controller.rb in phcmemberspro-88.0.0
- old
+ new
@@ -8,55 +8,54 @@
before_action :authenticate_user!
before_action :set_paper_trail_whodunnit
before_action :set_member_profile, only: [:show, :edit, :update, :destroy]
layout "phcmemberspro/member_profile", :only => [ :show ]
- # INDEX - Member Profile
+ # INDEX
def index
- @member_profiles = Member::Profile.where(org_id: current_user.org_id)
+ @member_profiles = Member::Profile.all
end
- # DETAILED PROFILE - Member Profile
+ # SHOW
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
- # NEW FORM - Member Profile
+ # NEW
def new
@member_profile = Member::Profile.new
end
- # EDIT FORM - Member Profile
+ # EDIT
def edit
end
- # POST - Member Profile
+ # CREATE
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, notice: 'Profile was successfully created.'
+ redirect_to member_profiles_url, :flash => { :success => 'Profile was successfully created.' }
else
render :new
end
end
- # PATCH/PUT - Member Profile
+ # UPDATE
def update
if @member_profile.update(member_profile_params)
- redirect_to member_profiles_url, notice: 'Profile was successfully updated.'
+ redirect_to member_profiles_url, :flash => { :success => 'Profile was successfully updated.' }
else
render :edit
end
end
- # DELETE - Member Profile
+ # DELETE
def destroy
@member_profile.destroy
- redirect_to member_profiles_url, notice: 'Profile was successfully destroyed.'
+ redirect_to member_profiles_url, :flash => { :error => 'Profile was successfully destroyed.' }
end
private
# Common Callbacks
@@ -64,10 +63,10 @@
@member_profile = Member::Profile.find(params[:id])
end
# Whitelist
def member_profile_params
- params.require(:member_profile).permit(:member_first_name, :member_last_name, :member_title, :member_email, :member_phone, :member_notes, :slug, :user_id, :org_id)
+ params.require(:member_profile).permit(:member_first_name, :member_last_name, :member_title, :member_email, :member_phone, :member_notes, :slug, :user_id)
end
end
end