Class: DonatesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- DonatesController
- Defined in:
- app/controllers/donates_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /donates POST /donates.json.
-
#destroy ⇒ Object
DELETE /donates/1 DELETE /donates/1.json.
-
#edit ⇒ Object
GET /donates/1/edit.
-
#index ⇒ Object
GET /donates GET /donates.json.
-
#new ⇒ Object
GET /donates/new GET /donates/new.json.
-
#show ⇒ Object
GET /donates/1 GET /donates/1.json.
-
#update ⇒ Object
PUT /donates/1 PUT /donates/1.json.
Instance Method Details
#create ⇒ Object
POST /donates POST /donates.json
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/donates_controller.rb', line 41 def create @donate = Donate.new(donate_params) respond_to do |format| if @donate.save format.html { redirect_to @donate, notice: t('controller.successfully_created', model: t('activerecord.models.donate')) } format.json { render json: @donate, status: :created, location: @donate } else format.html { render action: "new" } format.json { render json: @donate.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /donates/1 DELETE /donates/1.json
71 72 73 74 75 76 77 78 |
# File 'app/controllers/donates_controller.rb', line 71 def destroy @donate.destroy respond_to do |format| format.html { redirect_to(donates_url) } format.json { head :no_content } end end |
#edit ⇒ Object
GET /donates/1/edit
36 37 |
# File 'app/controllers/donates_controller.rb', line 36 def edit end |
#index ⇒ Object
GET /donates GET /donates.json
6 7 8 9 10 11 12 13 |
# File 'app/controllers/donates_controller.rb', line 6 def index @donates = Donate.order('id DESC').page(params[:page]) respond_to do |format| format.html # index.html.erb format.json { render json: @donates } end end |
#new ⇒ Object
GET /donates/new GET /donates/new.json
26 27 28 29 30 31 32 33 |
# File 'app/controllers/donates_controller.rb', line 26 def new @donate = Donate.new respond_to do |format| format.html # new.html.erb format.json { render json: @donate } end end |
#show ⇒ Object
GET /donates/1 GET /donates/1.json
17 18 19 20 21 22 |
# File 'app/controllers/donates_controller.rb', line 17 def show respond_to do |format| format.html # show.html.erb format.json { render json: @donate } end end |
#update ⇒ Object
PUT /donates/1 PUT /donates/1.json
57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/controllers/donates_controller.rb', line 57 def update respond_to do |format| if @donate.update_attributes(donate_params) format.html { redirect_to @donate, notice: t('controller.successfully_updated', model: t('activerecord.models.donate')) } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @donate.errors, status: :unprocessable_entity } end end end |