Class: Helpdesk::SubscribersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Helpdesk::SubscribersController
- Defined in:
- app/controllers/helpdesk/subscribers_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /subscribers POST /subscribers.json.
-
#destroy ⇒ Object
DELETE /subscribers/1 DELETE /subscribers/1.json.
-
#edit ⇒ Object
GET /subscribers/1/edit.
-
#index ⇒ Object
GET /subscribers GET /subscribers.json.
-
#new ⇒ Object
GET /subscribers/new GET /subscribers/new.json.
-
#show ⇒ Object
GET /subscribers/1 GET /subscribers/1.json.
-
#update ⇒ Object
PUT /subscribers/1 PUT /subscribers/1.json.
Methods inherited from ApplicationController
#default_url_options, #ensure_user
Instance Method Details
#create ⇒ Object
POST /subscribers POST /subscribers.json
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 43 def create @subscriber = Subscriber.new(params[:subscriber]) 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
75 76 77 78 79 80 81 82 83 |
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 75 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 |
#edit ⇒ Object
GET /subscribers/1/edit
37 38 39 |
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 37 def edit @subscriber = Subscriber.find(params[:id]) end |
#index ⇒ Object
GET /subscribers GET /subscribers.json
5 6 7 8 9 10 11 12 |
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 5 def index @subscribers = Subscriber.all respond_to do |format| format.html # index.html.erb format.json { render json: @subscribers } end end |
#new ⇒ Object
GET /subscribers/new GET /subscribers/new.json
27 28 29 30 31 32 33 34 |
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 27 def new @subscriber = Subscriber.new respond_to do |format| format.html # new.html.erb format.json { render json: @subscriber } end end |
#show ⇒ Object
GET /subscribers/1 GET /subscribers/1.json
16 17 18 19 20 21 22 23 |
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 16 def show @subscriber = Subscriber.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @subscriber } end end |
#update ⇒ Object
PUT /subscribers/1 PUT /subscribers/1.json
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/controllers/helpdesk/subscribers_controller.rb', line 59 def update @subscriber = Subscriber.find(params[:id]) respond_to do |format| if @subscriber.update_attributes(params[:subscriber]) 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 |