app/controllers/phcmemberspro/members/contacts_controller.rb in phcmemberspro-1.6.0 vs app/controllers/phcmemberspro/members/contacts_controller.rb in phcmemberspro-1.6.1

- old
+ new

@@ -16,59 +16,59 @@ end # Member Contact Index def index main = Members::Main.find(params[:main_id]) - @members_contacts = main.contacts.scoped_to(current_account).order('mccontactname ASC') + @members_contacts = main.contacts.current_user.order('mccontactname 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.current_user.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.current_user.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.current_user.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 = @main.contacts.current_user.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 end # Update Action def update - if @members_contact.scoped_to(current_account).update(members_contact_params) + if @members_contact.current_user.update(members_contact_params) redirect_to members_main_contacts_path, notice: 'Member contact information was successfully updated.' else render :edit end end # Delete Action def destroy @main = Members::Main.find(params[:main_id]) - @members_contact = @main.contacts.scoped_to(current_account).find(params[:id]) + @members_contact = @main.contacts.current_user.find(params[:id]) @members_contact.destroy redirect_to members_main_contacts_path, notice: 'Member contact information was successfully destroyed.' end private @@ -78,10 +78,10 @@ @members_contact = Members::Contact.find(params[:id]) end # White List def members_contact_params - params.require(:members_contact).permit(:mccontactname, :mccompanyname, :mcaddressl1, :mcaddressl2, :mccity, :mcprovince, :mccountry, :mcpostalcode, :mcphone, :mcwebsite, :mcemail, :main_id, :account_id) + params.require(:members_contact).permit(:mccontactname, :mccompanyname, :mcaddressl1, :mcaddressl2, :mccity, :mcprovince, :mccountry, :mcpostalcode, :mcphone, :mcwebsite, :mcemail, :main_id, :user_id) end end end