Sha256: 904a9f2d805e7b94c8713cd34fc79824b0f94ff1f1013619397f408e9043e75d
Contents?: true
Size: 1.98 KB
Versions: 1
Compression:
Stored size: 1.98 KB
Contents
require_dependency "phcmemberspro/application_controller" module Phcmemberspro class Member::ProfilesController < ApplicationController # Security & Action Filters before_action :require_user before_action :set_paper_trail_whodunnit before_action :set_member_profile, only: [:show, :edit, :update, :destroy] # INDEX - Member Profile def index @member_profiles = Member::Profile.where(oganization_id: membership_info.org_id) end # DETAILED PROFILE - Member Profile def show @member_profile = Member::Profile.find(params[:id]) @versions = PaperTrail::Version.where(item_id: params[:id], item_type: 'Phcmemberspro::Member::Profile') end # NEW FORM - Member Profile def new @member_profile = Member::Profile.new end # EDIT FORM - Member Profile def edit end # POST - Member Profile def create @member_profile = Member::Profile.new(member_profile_params) @member_profile.user_id = current_user.id @member_profile.membership_id = membership_info.id @member_profile.oganization_id = membership_info.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.membership_id = membership_info.id @member_profile.oganization_id = membership_info.org_id if @member_profile.update(member_profile_params) redirect_to member_profiles_url, notice: 'Profile was successfully updated.' else render :edit end end # DELETE - Member Profile def destroy @member_profile.destroy redirect_to member_profiles_url, notice: 'Profile was successfully destroyed.' end private # Common Callbacks def set_member_profile @member_profile = Member::Profile.find(params[:id]) end # Whitelist def member_profile_params params.require(:member_profile).permit(:mfirstname, :mlastname, :mtitle, :memail, :mphone, :mnotes) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
phcmemberspro-9.0.0 | app/controllers/phcmemberspro/member/profiles_controller.rb |