Class: Adherent::AdhesionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Adherent::AdhesionsController
- Defined in:
- app/controllers/adherent/adhesions_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /adhesions POST /adhesions.json.
-
#destroy ⇒ Object
DELETE /adhesion/1 DELETE /coords/1.json.
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
-
#update ⇒ Object
PUT /adhesions/1 PUT /adhesions/1.json.
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
POST /adhesions POST /adhesions.json
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/adherent/adhesions_controller.rb', line 43 def create @adhesion = @member.adhesions.new(adhesion_params) unless @adhesion.valid? flash[:notice] = @adhesion.errors. end respond_to do |format| if @adhesion.save format.html { redirect_to member_adhesions_url(@member), notice: 'Adhésion créée' } format.json { render json: @adhesion, status: :created, location: @adhesion } else format.html { render action: "new" } format.json { render json: @adhesion.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /adhesion/1 DELETE /coords/1.json
64 65 66 67 68 69 70 71 72 |
# File 'app/controllers/adherent/adhesions_controller.rb', line 64 def destroy @adhesion = @member.adhesions.find(params[:id]) @adhesion.destroy respond_to do |format| format.html { redirect_to member_adhesions_url(@member) } end end |
#edit ⇒ Object
17 18 19 |
# File 'app/controllers/adherent/adhesions_controller.rb', line 17 def edit @adhesion= @member.adhesions.find(params[:id]) end |
#index ⇒ Object
9 10 11 12 13 14 15 |
# File 'app/controllers/adherent/adhesions_controller.rb', line 9 def index @adhesions = @member.adhesions if @adhesions.empty? flash[:notice] = 'Pas encore d\'adhésion pour ce membre ; redirigé vers la création d\'une adhésion' redirect_to new_member_adhesion_url(@member) end end |
#new ⇒ Object
37 38 39 |
# File 'app/controllers/adherent/adhesions_controller.rb', line 37 def new @adhesion = @member.next_adhesion end |
#update ⇒ Object
PUT /adhesions/1 PUT /adhesions/1.json
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/adherent/adhesions_controller.rb', line 23 def update @adhesion = @member.adhesions.find(params[:id]) respond_to do |format| if @adhesion.update_attributes(adhesion_params) format.html { redirect_to member_adhesions_path(@member), notice: 'Adhésion mise à jour.' } format.json { head :no_content } else format.html { render action: "edit" } end end end |