Class: Adherent::CoordsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Adherent::CoordsController
- Defined in:
- app/controllers/adherent/coords_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /coords POST /coords.json.
-
#edit ⇒ Object
GET /coords/1/edit.
-
#new ⇒ Object
GET /coords/new GET /coords/new.json.
-
#show ⇒ Object
GET /coords/1 GET /coords/1.json.
-
#update ⇒ Object
PUT /coords/1 PUT /coords/1.json.
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
POST /coords POST /coords.json
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/adherent/coords_controller.rb', line 42 def create @coord = @member.build_coord(coord_params) respond_to do |format| if @coord.save format.html { redirect_to new_member_adhesion_url(@member), notice: 'Coordonnées enregistrées' } format.json { render json: @coord, status: :created, location: @coord } else format.html { render action: "new" } format.json { render json: @coord.errors, status: :unprocessable_entity } end end end |
#edit ⇒ Object
GET /coords/1/edit
36 37 38 |
# File 'app/controllers/adherent/coords_controller.rb', line 36 def edit @coord = @member.coord end |
#new ⇒ Object
GET /coords/new GET /coords/new.json
26 27 28 29 30 31 32 33 |
# File 'app/controllers/adherent/coords_controller.rb', line 26 def new @coord = @member.build_coord respond_to do |format| format.html # new.html.erb format.json { render json: @coord } end end |
#show ⇒ Object
GET /coords/1 GET /coords/1.json
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/adherent/coords_controller.rb', line 12 def show @coord = @member.coord unless @coord flash[:alert] = "Pas encore de coordonnées pour #{@member.to_s}" redirect_to new_member_coord_url(@member) and return end respond_to do |format| format.html # show.html.erb format.json { render json: @coord } end end |
#update ⇒ Object
PUT /coords/1 PUT /coords/1.json
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/controllers/adherent/coords_controller.rb', line 58 def update @coord = @member.coord respond_to do |format| if @coord.update_attributes(coord_params) format.html { redirect_to member_coord_path(@member), notice: 'Coordonnées mises à jour' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @coord.errors, status: :unprocessable_entity } end end end |