Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

When using with Rails, nil is being sent to partials, causing "ActionView::Template::Error: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id " #71

xxx opened this Issue · 3 comments

5 participants

Michael Dungan Michael Carey Ellis Berner Pavel Pravosud David Heinemeier Hansson
Michael Dungan
xxx commented

This is easier to show than describe, but after updating Jbuilder from 0.4.3 to 0.8.2, we are seeing errors where an instance variable that's being used in a template tries to render partials, even when it's nil.

I'm unable to repeat this issue with straight Jbuilder - it's only happening when used with Rails as far as I can tell, so this may need to be fixed on the Rails side. Jbuilder is the only thing I'm changing to cause these, however.

I will try to come up with a broken example app later, but I'm stuck in meetings for awhile and wanted to report this before I forgot.


# user.json.jbuilder
json.(@user, :id, :name)

# @friends is nil
json.friends @friends do |json, friend|
  json.partial! :partial => 'users/friend', :locals => {:friend => friend}

# _friend.json.jbuilder
json.(friend, :id, :name)
Michael Carey


Ellis Berner

Seeing this too...

Pavel Pravosud

Fixed by 780e047

David Heinemeier Hansson dhh closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.