Class: EventsController

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

Constant Summary

Constants included from FlashTruncation

FlashTruncation::STRING_OVERHEAD

Instance Method Summary collapse

Methods inherited from ApplicationController

#block_api_access, #evil_parameter_hack!, #extract_header_info, #set_cache_disabled!

Methods included from FlashTruncation

#max_flash_size, #truncate_flash, #truncate_flash_array

Instance Method Details

#createObject

rubocop:todo Metrics/AbcSize



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/events_controller.rb', line 11

def create # rubocop:todo Metrics/AbcSize
  # Compatible with NPG

  params[:event].delete(:key)

  @event = Event.create(params[:event])

  @event.eventful.save unless @event.eventful.nil?

  respond_to do |format|
    # I know this looks crazy, but it appears to be explicitly tested for
    # Unfortunately there is no comment as to why.
    # However a similar issue elsewhere in the codebase indicates that
    # its probably because NPG are missing accept headers in some cases
    # resulting in defaulting to HTML
    format.html { render xml: @event.to_xml }
    format.xml { render xml: @event.to_xml }
    format.json { render json: @event.to_json }
  end
end

#newObject



7
8
9
# File 'app/controllers/events_controller.rb', line 7

def new
  @event = Event.new
end