Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
xxx opened this Issue · 3 comments

5 participants

@xxx

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.

Example:

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

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


# _friend.json.jbuilder
json.(friend, :id, :name)
@mikecx

+1

@maletor

Seeing this too...

@rwz
Collaborator

Fixed by 780e047

@dhh 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.