Class: Iron::FieldDefinitionsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

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



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

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

#editObject



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

def edit
end

#newObject



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

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

#updateObject



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

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