Fixing bad check for undefined on activation keys page

For #1819, here is a snippet in which the undefined route that is being created in the Javascript:

```javascript
var url;
url += ("?content_view_id=" + $("#activation_key_content_view_id").val()); // "undefined?content_view_id=1"
```

The following if statement then fails because url is never undefined (due to that last line with the +=).

```javascript
if (url !== undefined) {
```

In order to fix this, we just need to check if url is undefined before we add something to it.

I also fixed another unrelated error in the activation_keys_controller.rb (where @environment is not defined).