rails/jbuilder — Issue #19: Using .where doesn't work
Author: cj
Created: 2012-02-07 18:52:14+00:00
State: open

So if I do `@users = User.all` then `json.users @users, :first_name, :last_name, :auth_level` everything works great. But if I do `@users = User.where(auth_level: 7)` then `json.users @users, :first_name, :last_name, :auth_level` I get:

```

ActionView::Template::Error (undefined local variable or method `first_name' for #):
app/views/v1/users/index.json.jbuilder:6:in `block in _app_views_v__users_index_json_jbuilder__979575319700469843_70262882566140'
app/views/v1/users/index.json.jbuilder:5:in `_app_views_v__users_index_json_jbuilder__979575319700469843_70262882566140'

Rendered /Users/cj/.rvm/gems/ruby-1.9.3-p0@global/gems/actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.8ms)
Rendered /Users/cj/.rvm/gems/ruby-1.9.3-p0@global/gems/actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.4ms)
Rendered /Users/cj/.rvm/gems/ruby-1.9.3-p0@global/gems/actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (9.4ms)
```
Is this a known bug or am I doing something wrong?