Class: Iron::FieldDefinitionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/iron/field_definitions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
# File 'app/controllers/iron/field_definitions_controller.rb', line 16

def create
  @field_definition = @schemable.field_definitions.build(field_definition_params)

  if @field_definition.save
    render :create, formats: :turbo_stream
  else
    render :new, status: :unprocessable_entity
  end
end

#destroyObject



34
35
36
37
# File 'app/controllers/iron/field_definitions_controller.rb', line 34

def destroy
  @field_definition.destroy!
  render :destroy, formats: :turbo_stream
end

#editObject



13
14
# File 'app/controllers/iron/field_definitions_controller.rb', line 13

def edit
end

#newObject



9
10
11
# File 'app/controllers/iron/field_definitions_controller.rb', line 9

def new
  @field_definition = @schemable.field_definitions.build(type: selected_field_definition_type)
end

#updateObject



26
27
28
29
30
31
32
# File 'app/controllers/iron/field_definitions_controller.rb', line 26

def update
  if @field_definition.update(field_definition_params)
    render :update, formats: :turbo_stream
  else
    render :edit, status: :unprocessable_entity
  end
end