app/controllers/phcmemberspro/members/contacts_controller.rb in phcmemberspro-5.2.7 vs app/controllers/phcmemberspro/members/contacts_controller.rb in phcmemberspro-5.3.1

- old
+ new

@@ -2,11 +2,11 @@ module Phcmemberspro class Members::ContactsController < ApplicationController # Security & Action Filters - before_filter :authenticate_user! + before_action :require_user layout 'layouts/phcmemberspro/members/members_all.html.erb' before_action :set_members_contact, only: [:show, :edit, :update, :destroy] # Add Member Contact Information before_action :phc_member_mains_info @@ -16,39 +16,40 @@ end # Member Contact Index def index main = Members::Main.find(params[:main_id]) - @members_contacts = main.contacts.scoped_to(current_account).order('mcprovince ASC') + @members_contacts = main.contacts.order('mcprovince ASC') end # Detailed Member Contact Information def show main = Members::Main.find(params[:main_id]) - @members_contact = main.contacts.scoped_to(current_account).find(params[:id]) + @members_contact = main.contacts.find(params[:id]) end # New Contact def new main = Members::Main.find(params[:main_id]) - @members_contact = main.contacts.scoped_to(current_account).build + @members_contact = main.contacts.build respond_to do |format| format.html # new.html.erb format.xml { render :xml => @members_contact } end end # Edit Contact def edit main = Members::Main.find(params[:main_id]) - @members_contact = main.contacts.scoped_to(current_account).find(params[:id]) + @members_contact = main.contacts.find(params[:id]) end # Create Action def create @main = Members::Main.find(params[:main_id]) - @members_contact = @main.contacts.scoped_to(current_account).create(members_contact_params) + @members_contact.user_id = current_user.id + @members_contact = @main.contacts.create(members_contact_params) if @members_contact.save redirect_to members_main_contacts_path, notice: 'Member contact information was successfully created.' else render :new end @@ -78,10 +79,10 @@ @members_contact = Members::Contact.find(params[:id]) end # White List def members_contact_params - params.require(:members_contact).permit(:mcaddressl1, :mcaddressl2, :mccity, :mcprovince, :mccountry, :mcpostalcode, :mctype, :main_id, :account_id) + params.require(:members_contact).permit(:mcaddressl1, :mcaddressl2, :mccity, :mcprovince, :mccountry, :mcpostalcode, :mctype, :main_id, :user_id) end end end