为什么irb和Rails控制台对[].blank?的结果不同?
以下是我的irb检查:
$ irb
2.1.0 :001 > a = []
=> []
2.1.0 :002 > a.blank?
NoMethodError: undefined method `blank?' for []:Array
from (irb):2
from /home/user/.rvm/rubies/ruby-2.1.0/bin/irb:11:in `<main>'
这是我的控制台检查:
$ rails c -e local
Loading local environment (Rails 4.1.5)
2.1.0 :001 > a = []
=> []
2.1.0 :002 > a.blank?
=> true