Class: IsotopeContacts::PhoneNumbersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IsotopeContacts::PhoneNumbersController
- Defined in:
- app/controllers/isotope_contacts/phone_numbers_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/isotope_contacts/phone_numbers_controller.rb', line 9 def create @phone_number = @contact.phone_numbers.new(params[:phone_number]) if @phone_number.save flash[:notice] = "Phone Number created successfully." redirect_to contact_path(@contact) else flash.now[:notice] = "There was a problem creating the phone number." render :new end end |
#destroy ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/isotope_contacts/phone_numbers_controller.rb', line 35 def destroy @phone_number = @contact.phone_numbers.find(params[:id]) if @phone_number.destroy flash[:notice] = "Phone Number was deleted successfully." redirect_to contact_path(@contact) else flash.now[:error] = "There was a problem deleting the phone number" redirect_to contact_path(@contact) end end |
#edit ⇒ Object
20 21 22 |
# File 'app/controllers/isotope_contacts/phone_numbers_controller.rb', line 20 def edit @phone_number = @contact.phone_numbers.find(params[:id]) end |
#new ⇒ Object
5 6 7 |
# File 'app/controllers/isotope_contacts/phone_numbers_controller.rb', line 5 def new @phone_number = @contact.phone_numbers.new(params[:phone_number]) end |
#update ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/isotope_contacts/phone_numbers_controller.rb', line 24 def update @phone_number = @contact.phone_numbers.find(params[:id]) if @phone_number.update_attributes(params[:phone_number]) flash[:notice] = "Phone Number updated successfully." redirect_to contact_path(@contact) else flash.now[:notice] = "There was a problem updating the phone number." render :edit end end |