Class: EventsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

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

Instance Method Details

#createObject


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

def create
  # Compatible with NPG

  params[:event].delete(:key)

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

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

  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


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

def new
  @event = Event.new
end