Class: UserGroupHasCheckoutTypesController

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

Instance Method Summary collapse

Instance Method Details

#createObject

POST /user_group_has_checkout_types POST /user_group_has_checkout_types.json



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

def create
  @user_group_has_checkout_type = UserGroupHasCheckoutType.new(user_group_has_checkout_type_params)

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

#destroyObject

DELETE /user_group_has_checkout_types/1 DELETE /user_group_has_checkout_types/1.json



79
80
81
82
83
84
85
86
# File 'app/controllers/user_group_has_checkout_types_controller.rb', line 79

def destroy
  @user_group_has_checkout_type.destroy

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

#editObject

GET /user_group_has_checkout_types/1/edit



42
43
# File 'app/controllers/user_group_has_checkout_types_controller.rb', line 42

def edit
end

#indexObject

GET /user_group_has_checkout_types GET /user_group_has_checkout_types.json



9
10
11
12
13
14
15
16
# File 'app/controllers/user_group_has_checkout_types_controller.rb', line 9

def index
  @user_group_has_checkout_types = UserGroupHasCheckoutType.includes([:user_group, :checkout_type]).order('user_groups.position, checkout_types.position').page(params[:page])

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

#newObject

GET /user_group_has_checkout_types/new GET /user_group_has_checkout_types/new.json



29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/user_group_has_checkout_types_controller.rb', line 29

def new
  @user_group_has_checkout_type = UserGroupHasCheckoutType.new(
    checkout_type: get_checkout_type,
    user_group: get_user_group
  )

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

#showObject

GET /user_group_has_checkout_types/1 GET /user_group_has_checkout_types/1.json



20
21
22
23
24
25
# File 'app/controllers/user_group_has_checkout_types_controller.rb', line 20

def show
  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @user_group_has_checkout_type }
  end
end

#updateObject

PUT /user_group_has_checkout_types/1 PUT /user_group_has_checkout_types/1.json



64
65
66
67
68
69
70
71
72
73
74
75
# File 'app/controllers/user_group_has_checkout_types_controller.rb', line 64

def update
  respond_to do |format|
    if @user_group_has_checkout_type.update(user_group_has_checkout_type_params)
      format.html { redirect_to @user_group_has_checkout_type, notice: t('controller.successfully_updated', model: t('activerecord.models.user_group_has_checkout_type')) }
      format.json { head :no_content }
    else
      prepare_options
      format.html { render action: "edit" }
      format.json { render json: @user_group_has_checkout_type.errors, status: :unprocessable_entity }
    end
  end
end