Use if-flows instead of rescue-flows
This commit is contained in:
parent
182afee970
commit
19add3f534
4 changed files with 31 additions and 23 deletions
|
@ -11,11 +11,13 @@ class ApiEntreprise::EntrepriseAdapter
|
|||
end
|
||||
|
||||
def to_params
|
||||
params = data_source[:entreprise].slice(*attr_to_fetch)
|
||||
params[:date_creation] = Time.at(params[:date_creation]).to_datetime
|
||||
params
|
||||
rescue
|
||||
nil
|
||||
if data_source.present?
|
||||
params = data_source[:entreprise].slice(*attr_to_fetch)
|
||||
params[:date_creation] = Time.at(params[:date_creation]).to_datetime
|
||||
params
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue