Hi all,

Just wondering about equality in rails for access to certain features
such as the following.

I have a table for games and all users are able to click on the show
button to display the actual record. On the show page it has the options
to go back or edit. I want to do the following

If the current_user equals the id associated with the game
     Then allow the to edit
  else
     redirect the back to the product show page
  end

The only line I am not sure on how to do is to match current user with
the id associated user_id of the game.

Any suggestions?

what I have is the following but no luck:

  def edit
    if current_user.id = @game.user_id
    @game = Game.find(params[:id])
    else
    format.html { redirect_to root_url }
    end
  end

-- 
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.

Reply via email to