Hi all,
I have a template that is sometimes given a local like so:
render :partial => ‘shared/new_addresses’, :locals => {:addresses =>
addresses}
In the partial I do this to make sure everything is cool:
if defined? addresses && !addresses.nil? && addresses[:z_address]
@address = addresses[:z_address]
end
Now, here’s where things get weird. After the app has been running a
while in production I start getting exceptions being thrown due to
addresses being nil on the assignment line above. Even though I make
sure it isn’t in the if statement!
If I do this:
if defined? addresses && !addresses.nil? && addresses[:z_address]
if !addresses.nil?
@address = addresses[:z_address]
end
end
I don’t get the errors.
Any one have a clue as to what is happening here?
Cheers,
–Ed