Class: SubscribesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- SubscribesController
- Defined in:
- app/controllers/subscribes_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /subscribes POST /subscribes.json.
-
#destroy ⇒ Object
DELETE /subscribes/1 DELETE /subscribes/1.json.
-
#edit ⇒ Object
GET /subscribes/1/edit.
-
#index ⇒ Object
GET /subscribes GET /subscribes.json.
-
#new ⇒ Object
GET /subscribes/new GET /subscribes/new.json.
-
#show ⇒ Object
GET /subscribes/1 GET /subscribes/1.json.
-
#update ⇒ Object
PUT /subscribes/1 PUT /subscribes/1.json.
Instance Method Details
#create ⇒ Object
POST /subscribes POST /subscribes.json
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/subscribes_controller.rb', line 45 def create @subscribe = Subscribe.new(subscribe_params) respond_to do |format| if @subscribe.save format.html { redirect_to @subscribe, notice: t('controller.successfully_created', model: t('activerecord.models.subscribe')) } format.json { render json: @subscribe, status: :created, location: @subscribe } else format.html { render action: "new" } format.json { render json: @subscribe.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /subscribes/1 DELETE /subscribes/1.json
75 76 77 78 79 80 81 82 |
# File 'app/controllers/subscribes_controller.rb', line 75 def destroy @subscribe.destroy respond_to do |format| format.html { redirect_to subscribes_url } format.json { head :no_content } end end |
#edit ⇒ Object
GET /subscribes/1/edit
40 41 |
# File 'app/controllers/subscribes_controller.rb', line 40 def edit end |
#index ⇒ Object
GET /subscribes GET /subscribes.json
8 9 10 11 12 13 14 15 |
# File 'app/controllers/subscribes_controller.rb', line 8 def index @subscribes = Subscribe.page(params[:page]) respond_to do |format| format.html # index.html.erb format.json { render json: @subscribes } end end |
#new ⇒ Object
GET /subscribes/new GET /subscribes/new.json
28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/subscribes_controller.rb', line 28 def new @subscribe = Subscribe.new @subscribe.subscription = @subscription if @subscription @subscribe.work = @work if @work respond_to do |format| format.html # new.html.erb format.json { render json: @subscribe } end end |
#show ⇒ Object
GET /subscribes/1 GET /subscribes/1.json
19 20 21 22 23 24 |
# File 'app/controllers/subscribes_controller.rb', line 19 def show respond_to do |format| format.html # show.html.erb format.json { render json: @subscribe } end end |
#update ⇒ Object
PUT /subscribes/1 PUT /subscribes/1.json
61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/controllers/subscribes_controller.rb', line 61 def update respond_to do |format| if @subscribe.update(subscribe_params) format.html { redirect_to @subscribe, notice: t('controller.successfully_updated', model: t('activerecord.models.subscribe')) } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @subscribe.errors, status: :unprocessable_entity } end end end |