string comparison - rails comparing values of params[:id] and session[:user_id] not working -


I am new to rail after moving ahead with PHP and I have no end to frustration, but hopefully one Big learning is curve.

I was following a guide on making a Twitter clone in the train, and continued on the path that makes it more and more Twitter.

So I have a 'User' page / user / show.HHRR which shows all the posts from a user.

Now, if the currently logged in user is similar to the page owner, I am trying to show the text box so that the user can add a new entry.

I have found that it should be very simple

 & lt;% if the consultation [[id] == session [: user_id]% & gt; Place the text box here & lt;% end% & gt; 

Of course, that's not working, but just above that, I've outputed both session [[user_id] and paramode [: id], and the printout is exactly the same.

If I == to! = I get the message 'Put a text box'.

Any suggestions as to what I am doing wrong? I know that these two values ​​are given because I can see the URL and currently in the user's logout output. I also output

 - & lt;% session [: user_id]% & gt; - - & lt;% params [: id]% & gt; - 

So that I can see there are no gaps or spaces or other characters at any end of the parameters, and it all looks clean.

The output looks like this

 -4c4483ae15a7900fcc000003- -4c4483ae15a7900fcc000003- 

Which is a mongodb object with a dashed user on either side to show that someone Location or nothing.

Are you sure both items are simple strings? What happens if you move

  consulting [: id] .to_s == session [: user_id] .to_s  

?


Comments