Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/audio/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby nil:NilClass的未定义方法电子邮件_Ruby - Fatal编程技术网

Ruby nil:NilClass的未定义方法电子邮件

Ruby nil:NilClass的未定义方法电子邮件,ruby,Ruby,如何修复此错误 频道中的命名错误::配置文件#显示 显示/home/action/catarse/app/views/catarse_bootstrap/shared/_header_channel.html.slim,其中第16行凸起: nil:NilClass的未定义方法“email” 提取的源(第16行附近): 13 14 15 16 17 18 十九, 模板包含跟踪:app/views/catarse_bootstrap/channels/profiles/show.html.slim

如何修复此错误

频道中的命名错误::配置文件#显示 显示/home/action/catarse/app/views/catarse_bootstrap/shared/_header_channel.html.slim,其中第16行凸起:

nil:NilClass的未定义方法“email” 提取的源(第16行附近): 13 14 15 16 17 18 十九,

模板包含跟踪:app/views/catarse_bootstrap/channels/profiles/show.html.slim

Rails.root:/home/action/catarse

应用程序跟踪|框架跟踪|完整跟踪 app/views/catarse\u bootstrap/shared/\u header\u channel.html.slim:16:in
\u app\u views\u catarse\u bootstrap\u shared\u header\u channel\u html\u slim\u 4148437850825180179\u 67490200'
app/views/catarse\u bootstrap/channels/profiles/show.html.slim:1:in
\u app\u views\u catarse\u bootstrap\u channels\u profiles\u show\u html\u slim\u 26114547747879\u 66362380' 请求

参数:

没有 切换会话转储 切换环境转储 回应

标题:


以下是github的答案:

你的路线有问题。您应该像在本地服务器中一样在ProjectsController#索引中,而不是在ChannelsController中。查看config/routes.rb:31您可能正在使用未在正则表达式中列出的子域(www、secure、test和local)

如果您使用的是子域,则必须将其添加到config/routes.rb中
约束子域:/^(?www | secure | test | local | subdomain)(\w+)/do

很明显,您的
频道
变量保持
nil
值。你是怎么设置的?嗨,我是ruby新手,所以我不明白你问什么?你能解释更多关于帮助的感谢吗?你的错误意味着
频道
为零。你能显示一行你设置它的值吗?-如果当前用户li.nav-item=link\u到“#”,类:'user menu'do=image\u标签(当前用户显示图像,:size=>“40x40”,类:'user avatar'),我在哪里找到这行?
           = mail_to channel.email, t('channels.header.contact'), title: t('channels.header.contact'), class: 'standard-link', target: '_blank'
         - if current_user
           li.nav-item
             = link_to '#', class: 'user-menu' do
               = image_tag(current_user.display_image, :size => "40x40", class: 'user-avatar')
             ul.dropdown.user
               li= link_to t('channels.header.profile'), current_user