开发者

Ruby on rails: printing the variable name for debugging purposes in the console

Lets say I have i variable var witch is a pointer to another variable named user_id.

How do I puts var such that I can see in the console user_id = (whatever the value is)

Reason why I want to do this, is because I want to write a method called print_debug_block, where you give it an array of variables, and it prints in the following format:

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||开发者_如何学C|||||||  
var1 = valOfVar1  
var2 = valOfVar2  
var3 = valOfVar3  
etc  
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||


logger.debug() outputs to the log.

See http://guides.rubyonrails.org/debugging_rails_applications.html#the-logger

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜