我正在
BuyTagsController #index中的NoMethodError 未定义的方法`unpack'为零:NilClass
第#18行提取的来源( if($driver==='mssql' || $driver==='dblib')
$pdoClass='CMssqlPdoAdapter';
elseif($driver==='sqlsrv')
$pdoClass='CMssqlSqlsrvPdoAdapter';
):
buy_tags_controller.rb
应用程序跟踪:
eco_producer.nreduction = eco_value['nreduction']
str = eco_value['image']
eco_producer.image = Base64.decode64(str)
eco_producer.save
end
答案 0 :(得分:7)
>> Base64.decode64(nil)
NoMethodError: undefined method `unpack' for nil:NilClass
from C:/Ruby193/lib/ruby/1.9.1/base64.rb:58:in `decode64'
from (irb):7
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.21/lib/rails/commands/console.rb:47:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.21/lib/rails/commands/console.rb:8:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.21/lib/rails/commands.rb:41:in `<top (required)>'
from C:/workspace/projects/YBWebFramework/director2/script/rails:11:in `require'
from C:/workspace/projects/YBWebFramework/director2/script/rails:11:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
解决此问题。有一张支票,没有通过nil解码。像str .present那样的东西?然后执行下一行