app/controllers/phcmemberspro/member/addresses_controller.rb in phcmemberspro-87.0.0 vs app/controllers/phcmemberspro/member/addresses_controller.rb in phcmemberspro-88.0.0

- old
+ new

@@ -8,62 +8,61 @@ before_action :phcmemberspro_get_member_profile_info before_action :authenticate_user! before_action :set_paper_trail_whodunnit before_action :set_member_address, only: [:show, :edit, :update, :destroy] - # INDEX - Directory Listings + # INDEX def index profile = Member::Profile.find(params[:profile_id]) - @member_addresses = profile.addresses.where(org_id: current_user.org_id) + @member_addresses = profile.addresses.all end - # LISTINGS DETAILS - Directory Listings + # SHOW def show profile = Member::Profile.find(params[:profile_id]) @member_address = profile.addresses.find(params[:id]) @member_address_versions = Phcmemberspro::AddressVersions.where(item_id: @member_address, item_type: 'Phcmemberspro::Member::Address') end - # NEW - Directory Listings + # NEW def new profile = Member::Profile.find(params[:profile_id]) @member_address = profile.addresses.build end - # EDIT - Directory Listings + # EDIT def edit end - # POST - Directory Listings + # CREATE def create @profile = Member::Profile.find(params[:profile_id]) @member_address = @profile.addresses.create(member_address_params) @member_address.user_id = current_user.id - @member_address.org_id = current_user.org_id if @member_address.save - redirect_to member_profile_addresses_url, notice: 'Address was successfully created.' + redirect_to member_profile_addresses_url, :flash => { :success => 'Address was successfully created.' } else render :new end end - # PATCH/PUT - Directory Listings + # UPDATE def update @profile = Member::Profile.find(params[:profile_id]) if @member_address.update(member_address_params) - redirect_to member_profile_addresses_url, notice: 'Address was successfully updated.' + redirect_to member_profile_addresses_url, :flash => { :success => 'Address was successfully updated.' } else render :edit end end - # DELETE - Directory Listings + # DELETE def destroy @profile = Member::Profile.find(params[:profile_id]) @member_address = @profile.addresses.find(params[:id]) @member_address.destroy - redirect_to member_profile_addresses_url, notice: 'Listing was successfully destroyed.' + redirect_to member_profile_addresses_url, :flash => { :error => 'Listing was successfully destroyed.' } end private # Common Callbacks @@ -71,10 +70,10 @@ @member_address = Member::Address.find(params[:id]) end # Whitelist def member_address_params - params.require(:member_address).permit(:address_address_line_1, :address_address_line_2, :address_city, :address_province, :address_country, :address_postal_code, :address_type, :user_name, :profile_id, :slug, :user_id, :org_id) + params.require(:member_address).permit(:address_address_line_1, :address_address_line_2, :address_city, :address_province, :address_country, :address_postal_code, :address_type, :user_name, :profile_id, :slug, :user_id) end end end