Undefined method `include?'


#1

Hi guys,
I was just working on this application (http://pastie.org/329613) when I
added this line “session[:user].include?(params[:id])” to an unless
statement and the app threw this error:

NoMethodError in SignupsController#show
undefined method include?' for 27:Fixnum Application Trace: app/controllers/signups_controller.rb:35:inauthorize’

Any ideas? Thanks in advance!


#2

On Wed, Dec 3, 2008 at 10:02 AM, Patrick L.
removed_email_address@domain.invalid wrote:

Hi guys,
I was just working on this application (http://pastie.org/329613) when I
added this line “session[:user].include?(params[:id])” to an unless
statement and the app threw this error:

session is a Hash, and when you do session[:user], you’re getting back
the
value referenced by the key :user.

NoMethodError in SignupsController#show
undefined method `include?’ for 27:Fixnum

and it turns out that you stored 27 in there.

You may simply check the value against the params, if that’s what you
need
to do à la if session[:user] == params[:id]

Franz