Update array in rails action?
- by Elliot
Hey guys,
I have the following code in an action:
@user = @current_user
@user.votes[1430]='up'
@user.update_attributes(params[:user])
Votes is a string type, there is no default value - I just want to set it for the first time when this action occurs.
Unfortunately I get this error:
NoMethodError
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.votes
any ideas what I'm doing wrong?