Class: Admin::CustomFieldsController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/admin/custom_fields_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



29
30
31
32
33
34
35
36
# File 'app/controllers/admin/custom_fields_controller.rb', line 29

def create
  @custom_field  = CustomField.new params[:custom_field]
  if @custom_field.save
    redirect_to admin_custom_fields_url, notice: t(:successfully_added)
  else
    respond_with @custom_field
  end
end

#destroyObject



38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/admin/custom_fields_controller.rb', line 38

def destroy
  respond_to do |format|
    format.html do
      if @custom_field.destroy
        redirect_to admin_custom_fields_path, notice: t(:successfully_deleted)
      else
        redirect_to admin_custom_fields_path, error: t(:could_not_delete)
      end
    end
  end
end

#editObject



12
13
14
# File 'app/controllers/admin/custom_fields_controller.rb', line 12

def edit
  respond_with @custom_field
end

#indexObject



7
8
9
10
# File 'app/controllers/admin/custom_fields_controller.rb', line 7

def index
  @custom_fields = CustomField.all
  respond_with @custom_fields
end

#newObject



24
25
26
27
# File 'app/controllers/admin/custom_fields_controller.rb', line 24

def new
  @custom_field = CustomField.new
  respond_with @custom_field
end

#updateObject



16
17
18
19
20
21
22
# File 'app/controllers/admin/custom_fields_controller.rb', line 16

def update
  if @custom_field.update_attributes params[:custom_field]
    redirect_to admin_custom_fields_path, notice: t(:successfully_updated)
  else
    respond_with @custom_field
  end
end