Why not just this:

```ruby
cve = ContentViewEnvironment.where(key => value).first
```