Flash Messages in Jade

Following this example: http://scotch.io/tutorials/javascript/easy-node-authentication-setup-and-local and everything works fine except the Flash messages part.

I have changed the view engine to Jade instead of EJS but I just can't seem to get the flash messages to show.

The code provided in the ejs view is:

<% if (message.length > 0) { %>
  <div class="alert alert-danger"><%= message %></div>
<% } %>

and I would have thought that I could do this instead for Jade:

if #{message}
  p message

or even:

if message
  p message

but no success. Any idea what I'm doing wrong?

Note I have included all the necessary libraries as per the tutorial

Here's how I used flashes in Jade...

-if(messages)
        div#note #{messages}

And use this to render your view, passing the messages var to your view

req.flash('info', "Credenciales invalidas, intente nuevamente");
res.render('index', {messages: req.flash('info')});

That works for me

I went ahead and used a custom callback like so:

app.post('/login', function(req, res, next) {
        passport.authenticate('local-login', function(err, user, info) {
            if (err) { return next(err); }
            if (!user) { return res.render('login', {message: req.flash('loginMessage')}); }
            req.logIn(user, function(err) {
                if (err) { return next(err); }
                return res.redirect('/users/' + user.username);
            });
        })(req, res, next);
    });