I have been trying to get this to work but have been unsuccessful.
What is happening exactly?
Hiding functionality in the UI is just security by obscurity, which is not at all secure. Just hiding the UI features does not prevent a user from submitting the actions directly through some other means. There are libraries that help with authorization, such as cancancan and pundit. I would look into those libraries for securing your objects (I like pundit).
But for a simple solution, you could hide the elements in the UI using your if statement and then use a before_action to ensure the profile they are editing or deleting is theirs. Something simple:
before_action :ensure_profile_ownership, only: [:edit, :update, :destroy]
if current_user.profile_id != params[:id]
redirect_to profile_path(params[:id]), notice: 'Some message about not having access to perform that action'
Note this code is generally what cancancan and pundit do for you and I recommend using one of these if your authorization strategy gets any more complicated than this.