Class: DatashiftJourney::FormsController

Inherits:
ActionController::API
  • Object
show all
Includes:
ErrorRenderer
Defined in:
app/controllers/datashift_journey/page_states_controller.rb

Instance Method Summary collapse

Methods included from ErrorRenderer

#render_error

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/datashift_journey/page_states_controller.rb', line 16

def create
  @collector_form = Collector::FormDefinition.new(page_state_params)

  if @collector_form.save
    render json: @collector_form, status: :created
  else
    render_error(@collector_form, :unprocessable_entity) and return
    #render json: { errors: @collector_form.errors }, status: :unprocessable_entity
  end
end

#indexObject

PageState contains details for rendering and storing a Page related to a single State



10
11
12
13
14
# File 'app/controllers/datashift_journey/page_states_controller.rb', line 10

def index
  @collector_forms = Collector::FormDefinition.all

  render json: @collector_forms, status: :ok
end

#showObject



27
28
29
# File 'app/controllers/datashift_journey/page_states_controller.rb', line 27

def show
  render json: @collector_form
end