String issue

Hello,

I am trying to display the time spent in performing an activity in HTML
format.

The code below does that. If the time is 0 it shouldn’t show anything
else it should show the “time” followed by “hours” word.

"


#{start_time[:hrs] == 0 ? “” : start_time[:hrs] + hours} "

The way I am trying to do is giving problems.

“TypeError Exception: String can’t be coerced into Fixnum”
This is because of the “+ hours” in the code.

Any solution to get this done?

Prashant K. schrieb:

"

The way I am trying to do is giving problems.

“TypeError Exception: String can’t be coerced into Fixnum”
This is because of the “+ hours” in the code.

Any solution to get this done?

start_time[:hrs].to_s + hours

Thanks for your solution