app/controllers/phcmemberspro/members/contacts_controller.rb in phcmemberspro-1.0.6 vs app/controllers/phcmemberspro/members/contacts_controller.rb in phcmemberspro-1.5.5

- old
+ new

@@ -16,58 +16,58 @@ end # Member Contact Index def index main = Members::Main.find(params[:main_id]) - @members_contact = main.contacts + @members_contacts = main.contacts.scoped_to(current_account).order('mccontactname ASC') end # Detailed Member Contact Information def show main = Members::Main.find(params[:main_id]) - @members_contact = main.contacts.find(params[:id]) + @members_contact = main.contacts.scoped_to(current_account).find(params[:id]) end # New Contact def new main = Members::Main.find(params[:main_id]) - @members_contact = main.contacts.build + @members_contact = main.contacts.scoped_to(current_account).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.find(params[:id]) + @members_contact = main.contacts.scoped_to(current_account).find(params[:id]) end # Create Action def create @main = Members::Main.find(params[:main_id]) - @members_contact = @main.contacts.create(members_contact_params) + @members_contact = @main.contacts.scoped_to(current_account).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.update(members_contact_params) + if @members_contact.scoped_to(current_account).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.find(params[:id]) + @members_contact = @main.contacts.scoped_to(current_account).find(params[:id]) @members_contact.destroy redirect_to members_main_contacts_path, notice: 'Member contact information was successfully destroyed.' end private