Using local_assigns.has_key? instead of defined? in views.