Class: Jackpot::SubscriptionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Jackpot::SubscriptionsController
- Defined in:
- app/controllers/jackpot/subscriptions_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /subscriptions POST /subscriptions.json.
-
#destroy ⇒ Object
DELETE /subscriptions/1 DELETE /subscriptions/1.json.
-
#edit ⇒ Object
GET /subscriptions/1/edit.
-
#index ⇒ Object
GET /subscriptions GET /subscriptions.json.
-
#new ⇒ Object
GET /subscriptions/new GET /subscriptions/new.json.
-
#show ⇒ Object
GET /subscriptions/1 GET /subscriptions/1.json.
-
#update ⇒ Object
PUT /subscriptions/1 PUT /subscriptions/1.json.
Instance Method Details
#create ⇒ Object
POST /subscriptions POST /subscriptions.json
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/jackpot/subscriptions_controller.rb', line 44 def create @subscription = Subscription.new(params[:subscription]) respond_to do |format| if @subscription.save format.html { redirect_to @subscription, notice: 'Subscription was successfully created.' } format.json { render json: @subscription, status: :created, location: @subscription } else format.html { render action: "new" } format.json { render json: @subscription.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /subscriptions/1 DELETE /subscriptions/1.json
76 77 78 79 80 81 82 83 84 |
# File 'app/controllers/jackpot/subscriptions_controller.rb', line 76 def destroy @subscription = Subscription.find(params[:id]) @subscription.destroy respond_to do |format| format.html { redirect_to subscriptions_url } format.json { head :ok } end end |
#edit ⇒ Object
GET /subscriptions/1/edit
38 39 40 |
# File 'app/controllers/jackpot/subscriptions_controller.rb', line 38 def edit @subscription = Subscription.find(params[:id]) end |
#index ⇒ Object
GET /subscriptions GET /subscriptions.json
6 7 8 9 10 11 12 13 |
# File 'app/controllers/jackpot/subscriptions_controller.rb', line 6 def index @subscriptions = Subscription.all respond_to do |format| format.html # index.html.erb format.json { render json: @subscriptions } end end |
#new ⇒ Object
GET /subscriptions/new GET /subscriptions/new.json
28 29 30 31 32 33 34 35 |
# File 'app/controllers/jackpot/subscriptions_controller.rb', line 28 def new @subscription = Subscription.new respond_to do |format| format.html # new.html.erb format.json { render json: @subscription } end end |
#show ⇒ Object
GET /subscriptions/1 GET /subscriptions/1.json
17 18 19 20 21 22 23 24 |
# File 'app/controllers/jackpot/subscriptions_controller.rb', line 17 def show @subscription = Subscription.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @subscription } end end |
#update ⇒ Object
PUT /subscriptions/1 PUT /subscriptions/1.json
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/controllers/jackpot/subscriptions_controller.rb', line 60 def update @subscription = Subscription.find(params[:id]) respond_to do |format| if @subscription.update_attributes(params[:subscription]) format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @subscription.errors, status: :unprocessable_entity } end end end |