Sha256: f1591d4d0b25fe2e616a79c5c12d3b1d0e9986602acb8b704a490361610d1038
Contents?: true
Size: 1.47 KB
Versions: 1
Compression:
Stored size: 1.47 KB
Contents
module DmEvent module PermittedParams #------------------------------------------------------------------------------ def workshop_params params.require(:workshop).permit! if can? :manage_events, :all end #------------------------------------------------------------------------------ def workshop_price_params params.require(:workshop_price).permit! if can? :manage_events, :all end #------------------------------------------------------------------------------ def registration_params return nil if params[:registration].nil? || params[:registration].empty? if can? :manage_events, :all 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 #------------------------------------------------------------------------------ def system_email_params params.require(:system_email).permit! if can? :manage_events, :all end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dm_event-4.2.1.5 | app/models/dm_event/permitted_params.rb |