Class: IsotopeContacts::ContactsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IsotopeContacts::ContactsController
- Defined in:
- app/controllers/isotope_contacts/contacts_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/isotope_contacts/contacts_controller.rb', line 16 def create @contact = ::IsotopeContacts::Contact.new(params[:contact]) if @contact.save flash[:notice] = "Contact created successfully." redirect_to contact_path(@contact) else flash.now[:notice] = "There was a problem creating the contact." render :new end end |
#destroy ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/isotope_contacts/contacts_controller.rb', line 42 def destroy @contact = ::IsotopeContacts::Contact.find(params[:id]) if @contact.destroy flash[:notice] = "Contact was deleted successfully." redirect_to contacts_path else flash[:error] = "There was a problem deleting the contact" redirect_to contacts_path end end |
#edit ⇒ Object
27 28 29 |
# File 'app/controllers/isotope_contacts/contacts_controller.rb', line 27 def edit @contact = ::IsotopeContacts::Contact.find(params[:id]) end |
#index ⇒ Object
3 4 5 6 |
# File 'app/controllers/isotope_contacts/contacts_controller.rb', line 3 def index @search = ::IsotopeContacts::Contact.search(params[:search]) @contacts = @search.all end |
#new ⇒ Object
8 9 10 |
# File 'app/controllers/isotope_contacts/contacts_controller.rb', line 8 def new @contact = ::IsotopeContacts::Contact.new(params[:contact]) end |
#show ⇒ Object
12 13 14 |
# File 'app/controllers/isotope_contacts/contacts_controller.rb', line 12 def show @contact = ::IsotopeContacts::Contact.find(params[:id]) end |
#update ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/isotope_contacts/contacts_controller.rb', line 31 def update @contact = ::IsotopeContacts::Contact.find(params[:id]) if @contact.update_attributes(params[:contact]) flash[:notice] = "Contact was updated successfully." redirect_to contact_path(@contact) else flash.now[:error] = "There was a problem updating the contact." render :edit end end |