daily pastebin goal
75%
SHARE
TWEET

Untitled

a guest Oct 19th, 2018 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/app/controllers/crew_members_controller.rb b/app/controllers/crew_members_controller.rb
  2. index e8f426d..12411b6 100644
  3. --- a/app/controllers/crew_members_controller.rb
  4. +++ b/app/controllers/crew_members_controller.rb
  5. @@ -21,4 +21,14 @@ class CrewMembersController < ApplicationController
  6.         format.html # new.html.erb
  7.       end
  8.     end
  9. +  
  10. +   def destroy
  11. +     @film = Film.find(params[:film_id])
  12. +     @crew_member = @film.crew_members
  13. +     @crew_member.destroy
  14. +
  15. +     respond_to do |format|
  16. +       format.html { redirect_to films_url }
  17. +     end
  18. +   end
  19.  end
  20. diff --git a/app/views/films/show.html.erb b/app/views/films/show.html.erb
  21. index d57804b..31e9d08 100644
  22. --- a/app/views/films/show.html.erb
  23. +++ b/app/views/films/show.html.erb
  24. @@ -15,6 +15,7 @@
  25.      <li>
  26.        <%= single_crew_member.user.email %>
  27.        - <%= single_crew_member.role.title %>
  28. +      - <%= link_to 'Destroy', single_crew_member, confirm: 'Are you sure?', method: :delete %>
  29.      </li>
  30.    <% end %>
  31.  </ul>
  32. diff --git a/config/routes.rb b/config/routes.rb
  33. index b2fab16..5b56687 100644
  34. --- a/config/routes.rb
  35. +++ b/config/routes.rb
  36. @@ -1,6 +1,6 @@
  37.  Indiecrews::Application.routes.draw do
  38.    resources :films do
  39. -    resources :crew_members, :only => [:create, :new]
  40. +    resources :crew_members, :only => [:create, :new, :destroy]
  41.    end
  42.    devise_for :users
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top