change session(:cart).nil?
to session[:cart].nil?
session is not a method call
If we're picking nits it is - you just don't pass any arguments to it.
Fred