I think I'd rather see the assignment in a new line:

```ruby
if val
  val = val.to_s

  if !val.empty?
    # ...
  end
end
```