Class: Helpdesk::SubscribersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Helpdesk::SubscribersController
- Defined in:
- app/controllers/helpdesk/subscribers_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#destroy ⇒ Object
DELETE /subscribers/1 DELETE /subscribers/1.json.
- #new ⇒ Object
-
#update ⇒ Object
PUT /subscribers/1 PUT /subscribers/1.json.
Methods inherited from ApplicationController
#default_url_options, #ensure_user
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 14 def create @subscriber = Subscriber.new(subscriber_params) respond_to do |format| if @subscriber.save format.html { redirect_to @subscriber, notice: 'Subscriber was successfully created.' } format.json { render json: @subscriber, status: :created, location: @subscriber } else format.html { render action: "new" } format.json { render json: @subscriber.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /subscribers/1 DELETE /subscribers/1.json
46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 46 def destroy @subscriber = Subscriber.find(params[:id]) @subscriber.destroy respond_to do |format| format.html { redirect_to subscribers_url } format.json { head :no_content } end end |
#new ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 5 def new @subscriber = Subscriber.new respond_to do |format| format.html # new.html.erb format.json { render json: @subscriber } end end |
#update ⇒ Object
PUT /subscribers/1 PUT /subscribers/1.json
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 30 def update @subscriber = Subscriber.find(params[:id]) respond_to do |format| if @subscriber.update_attributes(subscriber_params) format.html { redirect_to @subscriber, notice: 'Subscriber was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @subscriber.errors, status: :unprocessable_entity } end end end |