Sha256: 36240aa18991e61f1d9c9dff726622db8e10c68e8a91482c5ded12bd32c36d9a
Contents?: true
Size: 1.52 KB
Versions: 1
Compression:
Stored size: 1.52 KB
Contents
require_dependency "blast/contacts/application_controller" module Blast module Contacts class ContactsController < ApplicationController before_action :set_contact, only: [:show, :edit, :update, :destroy] def index @contacts = current_user.contacts end def show end def new @contact = Contact.new end def edit end def create @contact = Contact.new(contact_params) @contact.user = current_user if @contact.save # Add blast to access the correct path redirect_to [blast, @contact], notice: 'Contact was successfully created.' else render :new end end def update if @contact.update(contact_params) # Add blast to access the correct path redirect_to [blast, @contact], notice: 'Contact was successfully updated.' else render :edit end end def destroy @contact.destroy # Add blast to access the correct path redirect_to blast.contacts_url, notice: 'Contact was successfully destroyed.' end private def set_contact @contact = Contact.find(params[:id]) end def contact_params # Add the parameters we allow params.require(:contact).permit(:first_name, :last_name, :company, :email, :phone, :user_id) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blast_contacts-0.0.1 | app/controllers/blast/contacts/contacts_controller.rb |