Class: Jackpot::SubscriptionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/jackpot/subscriptions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

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

#destroyObject

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

#editObject

GET /subscriptions/1/edit



38
39
40
# File 'app/controllers/jackpot/subscriptions_controller.rb', line 38

def edit
  @subscription = Subscription.find(params[:id])
end

#indexObject

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

#newObject

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

#showObject

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

#updateObject

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