Class: UserCheckoutStatsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/user_checkout_stats_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /user_checkout_stats POST /user_checkout_stats.json



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'app/controllers/user_checkout_stats_controller.rb', line 46

def create
  @user_checkout_stat = UserCheckoutStat.new(params[:user_checkout_stat])

  respond_to do |format|
    if @user_checkout_stat.save
      format.html { redirect_to @user_checkout_stat, :notice => t('controller.successfully_created', :model => t('activerecord.models.user_checkout_stat')) }
      format.json { render :json => @user_checkout_stat, :status => :created, :location => @user_checkout_stat }
    else
      format.html { render :action => "new" }
      format.json { render :json => @user_checkout_stat.errors, :status => :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /user_checkout_stats/1 DELETE /user_checkout_stats/1.json



76
77
78
79
80
81
82
83
# File 'app/controllers/user_checkout_stats_controller.rb', line 76

def destroy
  @user_checkout_stat.destroy

  respond_to do |format|
    format.html { redirect_to user_checkout_stats_url }
    format.json { head :no_content }
  end
end

#editObject

GET /user_checkout_stats/1/edit



41
42
# File 'app/controllers/user_checkout_stats_controller.rb', line 41

def edit
end

#indexObject

GET /user_checkout_stats GET /user_checkout_stats.json



7
8
9
10
11
12
13
14
# File 'app/controllers/user_checkout_stats_controller.rb', line 7

def index
  @user_checkout_stats = UserCheckoutStat.order('id DESC').page(params[:page])

  respond_to do |format|
    format.html # index.html.erb
    format.json { render :json => @user_checkout_stats }
  end
end

#newObject

GET /user_checkout_stats/new GET /user_checkout_stats/new.json



31
32
33
34
35
36
37
38
# File 'app/controllers/user_checkout_stats_controller.rb', line 31

def new
  @user_checkout_stat = UserCheckoutStat.new

  respond_to do |format|
    format.html # new.html.erb
    format.json { render :json => @user_checkout_stat }
  end
end

#showObject

GET /user_checkout_stats/1 GET /user_checkout_stats/1.json



18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/user_checkout_stats_controller.rb', line 18

def show
  CheckoutStatHasUser.per_page = 65534 if params[:format] == 'csv'
  @stats = @user_checkout_stat.checkout_stat_has_users.order('checkouts_count DESC, user_id').page(params[:page])

  respond_to do |format|
    format.html # show.html.erb
    format.json { render :json => @user_checkout_stat }
    format.csv
  end
end

#updateObject

PUT /user_checkout_stats/1 PUT /user_checkout_stats/1.json



62
63
64
65
66
67
68
69
70
71
72
# File 'app/controllers/user_checkout_stats_controller.rb', line 62

def update
  respond_to do |format|
    if @user_checkout_stat.update_attributes(params[:user_checkout_stat])
      format.html { redirect_to @user_checkout_stat, :notice => t('controller.successfully_updated', :model => t('activerecord.models.user_checkout_stat')) }
      format.json { head :no_content }
    else
      format.html { render :action => "edit" }
      format.json { render :json => @user_checkout_stat.errors, :status => :unprocessable_entity }
    end
  end
end