I have been trying to perform conditional actions in the controller
depending on values in the db - in this case, the object ‘info’ and the
column ‘status’. I would just like the controller to run an action
depending on the value in the column, in this case ‘OPEN’ or ‘SENT’:
- def infoupdate
- case @info.attribute(:status)
- when ‘OPEN’
but keep getting:
‘You have a nil object when you didn’t expect it!
The error occured while evaluating nil.attribute’
I believe something is wrong with my code in line 2. and I have been
trying many alternatives. Please, let me know what I am doing wrong.