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
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/affiliations_controller.rb', line 15 def create @affiliation = Affiliation.new( provider_id: current_user.id, customer_id: params[:affiliation][:customer_id] ) if @affiliation.save render :index else # Provider tried to save an invalid Affiliation (perhaps a duplicate) render :index, status: 403 # Forbidden action occurred end end |
- (Object) destroy
29 30 31 32 33 34 35 |
# File 'app/controllers/affiliations_controller.rb', line 29 def destroy @affiliation = Affiliation.find(params[:id]) if @affiliation.provider_id == current_user.id @affiliation.destroy end redirect_to affiliations_path end |
- (Object) index
7 8 9 |
# File 'app/controllers/affiliations_controller.rb', line 7 def index @affiliations = current_user.affiliations end |
- (Object) new
11 12 13 |
# File 'app/controllers/affiliations_controller.rb', line 11 def new @affiliation = Affiliation.new end |