Class: AffiliationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- AffiliationsController
- Defined in:
- app/controllers/affiliations_controller.rb
Instance Method Summary (collapse)
Methods inherited from ApplicationController
Instance Method Details
- (Object) create
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/affiliations_controller.rb', line 13 def create @affiliation = Affiliation.new( provider_id: current_user.id, customer_id: params[:affiliation][:customer_id] ) if @affiliation.save redirect_to 'index' else # Provider tried to save an invalid Affiliation (perhaps a duplicate) redirect_to 'index', status: 403 # Forbidden action occurred end end |
- (Object) destroy
27 28 29 30 31 |
# File 'app/controllers/affiliations_controller.rb', line 27 def destroy current_user.affiliations.find(params[:id]).destroy! redirect_to affiliations_path, success: 'Affiliation deleted successfully.' end |
- (Object) index
5 6 7 |
# File 'app/controllers/affiliations_controller.rb', line 5 def index @affiliations = current_user.affiliations end |
- (Object) new
9 10 11 |
# File 'app/controllers/affiliations_controller.rb', line 9 def new @affiliation = Affiliation.new end |