You forgot to put a . before the try:
@myvar = session[:comments].try(:[], @comment.id)
since [] is the name of the method when you do [@comment.id].
You forgot to put a . before the try:
@myvar = session[:comments].try(:[], @comment.id)
since [] is the name of the method when you do [@comment.id].