Class: EventRegistrationFormPortlet

Inherits:
Portlet
  • Object
show all
Defined in:
app/portlets/event_registration_form_portlet.rb

Instance Method Summary collapse

Instance Method Details

#registerObject



10
11
12
13
14
15
16
17
18
19
20
# File 'app/portlets/event_registration_form_portlet.rb', line 10

def register
  event = Event.find(self.event_id)
  event_registration = EventRegistration.new((params[:event_registration] || {}).merge(:event_id => event.id, :publish_on_save => true))
  if event_registration.save
    url_for_success
  else
    store_params_in_flash
    store_errors_in_flash(event_registration.errors)
    url_for_failure
  end
end

#renderObject



3
4
5
6
7
8
# File 'app/portlets/event_registration_form_portlet.rb', line 3

def render
  pmap = flash[instance_name] || params
  @event = Event.find(self.event_id)
  @event_registration = EventRegistration.new((pmap[:event_registration] || {}).merge(:event_id => @event.id))
  @event_registration.errors.add_from_hash flash["#{instance_name}_errors"]
end