Class: CustomerVault::LinksController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- CustomerVault::LinksController
- Defined in:
- app/controllers/customer_vault/links_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/customer_vault/links_controller.rb', line 20 def create :update, @person params = link_params bob = params[:bob].split("-") @link ||= Link.new(title: params[:title], alice_id: @person.id, alice_type: @person.class.to_s, bob_id: bob[1], bob_type: bob[0]) if @link.save flash[:notice] = 'Link was successfully created.' redirect_to url_for(@person) + "#links" else render :new end end |
#destroy ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/customer_vault/links_controller.rb', line 49 def destroy :update, @person @link = Link.find(params[:id]) if @link.destroy flash[:notice] = 'Individual was successfully destroyed.' else flash[:alert] = 'Individual was NOT destroyed.' end redirect_to url_for(@person) + "#links" end |
#edit ⇒ Object
14 15 16 17 18 |
# File 'app/controllers/customer_vault/links_controller.rb', line 14 def edit :update, @person @link = Link.find(params[:id]) end |
#new ⇒ Object
7 8 9 10 11 12 |
# File 'app/controllers/customer_vault/links_controller.rb', line 7 def new :update, @person @link ||= Link.new @people ||= Person.list end |
#update ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/controllers/customer_vault/links_controller.rb', line 36 def update :update, @person @link = Link.find(params[:id]) if @link.update(link_params) flash[:notice] = 'Link was successfully updated.' redirect_to url_for(@person) + "#links" else render :edit end end |