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
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/subscribes_controller.rb', line 44 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
74 75 76 77 78 79 80 81 |
# File 'app/controllers/subscribes_controller.rb', line 74 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
39 40 |
# File 'app/controllers/subscribes_controller.rb', line 39 def edit end |
#index ⇒ Object
GET /subscribes GET /subscribes.json
7 8 9 10 11 12 13 14 |
# File 'app/controllers/subscribes_controller.rb', line 7 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
27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/subscribes_controller.rb', line 27 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
18 19 20 21 22 23 |
# File 'app/controllers/subscribes_controller.rb', line 18 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
60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/controllers/subscribes_controller.rb', line 60 def update respond_to do |format| if @subscribe.update_attributes(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 |