RailsCasts Pro episodes are now free!

Learn more or hide this

David Krmpotic's Profile

GitHub User: davidhq

Comments by David Krmpotic

Avatar

this should be so:

ruby
def incoming(message, callback)
    if message['channel'] !~ %r{^/meta/}
      if message['ext'].nil? || message['ext']['auth_token'] != FAYE_TOKEN
        message['error'] = 'Invalid authentication token'
      end
    end
    callback.call(message)
  end

we have to check for message['ext'].nil? because if we don't and someone sends a request without the auth token, the server crashes.