How about something like this?

```ruby
views = {autocomplete: {0 => {id => view.id.to_s, name: u(view.name)}}}
repos = {search: ""}
env_ids = view.environments.map(&:id)
search = {search: {views: views, repos: repos, content_type: "repos", envs: env_ids}}
search += views.environments.inject
search.to_param
```