1
I got this code pad right here:
if contract.amendments.empty?
if Date.today - contract.due_date >= 30 || Date.today + contract.due_date <= 30
@start_date = contract.due_date + 1
@end_date = contract.due_date + 365
elsif Date.today - contract.due_date < 30
@start_date = Date.today
@end_date = contract.end_date
end
else
last_amendment = contract.amendments.last
if Date.today - last_amendment.due_date >= 30 || Date.today + last_amendment.due_date <= 30
@start_date = last_amendment.end_date + 1
@end_date = last_amendment.end_date + 365
elsif Date.today - last_amendment.end_date < 30
@start_date = Date.today
@end_date = last_amendment.end_date
end
end
And I would like to let you DRY, but I’m not getting it. I’m a beginner in Ruby
I see you never voted for anything. Did you know you can vote for all the posts on the site? Vote one whatever you think is useful for you and others. See more on the [tour].
– Maniero