Module: DmEvent::PermittedParams

Instance Method Summary collapse

Instance Method Details

#registration_params(workshop) ⇒ Object




17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/models/dm_event/permitted_params.rb', line 17

def registration_params(workshop)
  return nil if params[:registration].nil? || params[:registration].empty?
  if can?(:manage_event_registrations, @workshop)
    params.require(:registration).permit!
  else
    # nested attributes: because field_data can be either a single value or an array of values,
    # we include it twice in the permit, once as a normal param, and again as a param with data.
    # sample data:
    #  {"workshop_price_id"=>"72", "custom_fields_attributes"=>{"0"=>{"field_data"=>"234", "custom_field_def_id"=>"8"}, 
    #    "1"=>{"field_data"=>["eee", ""], "custom_field_def_id"=>"16"}}}
    params.require(:registration).permit(:workshop_price_id, custom_fields_attributes: [:field_data, {:field_data => []}, :custom_field_def_id])
  end
end

#system_email_paramsObject

access to this is protected before the call




33
34
35
# File 'app/models/dm_event/permitted_params.rb', line 33

def system_email_params
  params.require(:system_email).permit!
end

#workshop_paramsObject

access to this is protected before the call




6
7
8
# File 'app/models/dm_event/permitted_params.rb', line 6

def workshop_params
  params.require(:workshop).permit!
end

#workshop_price_paramsObject

access to this is protected before the call




12
13
14
# File 'app/models/dm_event/permitted_params.rb', line 12

def workshop_price_params
  params.require(:workshop_price).permit!
end