Others answered your main problem, but I want to say the following: I highly recommend using CanCan even for a very small project. It is very easy to use, and it will help you a lot, and you will have great clean code.
for example, in your situation, you can put this line in ability.rb to control the updating of user goals.
can :update, Goal, :user_id => user.id
and in your controller just click load_and_authorize_resource at the top. No manually before_filters, do not check any conditions or anything like that.
and wherever you need to change something to edit the goal, for example, in the index view, when listing links, you just put something like link_to_if(can?(:update, goal) , "edit goal", goal_path(goal) ){}
source share