jackc / jackc/tod

Exception handling for Rails multiparam attribute

Open
#66 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
447
Forks
56
PR merge metrics
No merged PRs in 30d

Description

Looks like this change introduced a bug

https://github.com/jackc/tod/blob/master/lib/tod/time_of_day.rb#L213

In some cases, values for individual values can be `nil` which breaks the initialization.

I propose adding default values if any of the results are undefined

```ruby
::Tod::TimeOfDay.new(time_of_day[4] || 0, time_of_day[5] || 0, time_of_day[6] || 0)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at lib/tod/time_of_day.rb around line 213 and inspect how the Rails multiparameter values are passed into Tod::TimeOfDay.new. Reproduce a case where one or more individual values are nil, then verify that initialization handles those values as proposed and no longer breaks.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.