If we call a partial with a name such that there also exists a
instance variable with the same name (ex: @identity) in the controller
then passing :object => nil to render() and calling (!
identity).inspect in ‘_identity.html.erb’ prints false while
identity.inspect prints nil.
Here is a more specific description -
Let there be a controller named Check.
class CheckController < ApplicationController
@identity = nil
views/check/index.html.erb contains -
<%= render :partial => ‘identity’, :object => nil %>
views/check/_identity.html.erb contains -
identity is <%= identity.inspect %> !identity is <%= (!identity).inspect %>
calling localhost:3000/check/ prints -
identity is nil
!identity is false
- There must be a controller instance variable with the same name as
- I have been able to trace the problem down to between line 31 and
42 of file
I’m using -
Ruby 1.8.6 (2007-09-14 patchlevel 111) [i386-mswin32]
Windows XP Home Ed. SP3
I’ve also uploaded a sample app folder at