Hm, i totally forgot about the self. I'm still trying to learn ruby and
everything. So the increaseVariable method looks like this. I just
edited it so it could use self and so i could scale how much wanted to
increase the variable.
def increaseVariable(scale)
tempoints = 1 * scale
self.variable += tempoints
logger.debug "User variable is now #{user.variable}"
end
so now this is what my controller looks like
def like
@post = Micropost.find(params[:id])
@user = @post.user_ids
respond_to do |format|
format.html
end
@user.increaseVariable(5)
@post.like_action
@user.save!
@post.save!
end
So when i run it, it says that there is an undefined method for
"variable" but its up in the attr_accessible. What else could be wrong?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.