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)
|
if !data_source.key?(:association)
|
||||||
{}
|
{}
|
||||||
else
|
else
|
||||||
|
association_id = data_source[:association][:id]
|
||||||
params = data_source[:association].slice(*attr_to_fetch)
|
params = data_source[:association].slice(*attr_to_fetch)
|
||||||
|
|
||||||
if params[:id].present? && valid_params?(params)
|
if association_id.present? && valid_params?(params)
|
||||||
params[:rna] = params[:id]
|
params[:rna] = association_id
|
||||||
params.except(:id).transform_keys { |k| :"association_#{k}" }
|
params.transform_keys { |k| :"association_#{k}" }
|
||||||
else
|
else
|
||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
|
@ -25,7 +26,6 @@ class ApiEntreprise::RNAAdapter < ApiEntreprise::Adapter
|
||||||
|
|
||||||
def attr_to_fetch
|
def attr_to_fetch
|
||||||
[
|
[
|
||||||
:id,
|
|
||||||
:titre,
|
:titre,
|
||||||
:objet,
|
:objet,
|
||||||
:date_creation,
|
:date_creation,
|
||||||
|
|
Loading…
Reference in a new issue