Simplify RNAAdapter#process_params
Avoid catching an attribute only to remove it a few lines later
This commit is contained in:
parent
b28607a3a6
commit
1ffd4a230b
1 changed files with 4 additions and 4 deletions
|
@ -12,11 +12,12 @@ class ApiEntreprise::RNAAdapter < ApiEntreprise::Adapter
|
|||
if !data_source.key?(:association)
|
||||
{}
|
||||
else
|
||||
association_id = data_source[:association][:id]
|
||||
params = data_source[:association].slice(*attr_to_fetch)
|
||||
|
||||
if params[:id].present? && valid_params?(params)
|
||||
params[:rna] = params[:id]
|
||||
params.except(:id).transform_keys { |k| :"association_#{k}" }
|
||||
if association_id.present? && valid_params?(params)
|
||||
params[:rna] = association_id
|
||||
params.transform_keys { |k| :"association_#{k}" }
|
||||
else
|
||||
{}
|
||||
end
|
||||
|
@ -25,7 +26,6 @@ class ApiEntreprise::RNAAdapter < ApiEntreprise::Adapter
|
|||
|
||||
def attr_to_fetch
|
||||
[
|
||||
:id,
|
||||
:titre,
|
||||
:objet,
|
||||
:date_creation,
|
||||
|
|
Loading…
Reference in a new issue