在我的网站上,一个用户有一个个人档案,其中有一个指向他个人外部网站的链接.我在postgresql数据库中以名称website存储的站点的url.当我测试结果时,我总是得到这样一个url:
http://localhost:3000/www.example.com
而不是http://www.example.com
我的视图index.html.erb如下所示:
<% provide(:title, 'All projects') %>
<h1>All projects</h1>
<%= will_paginate %>
<ul class="microposts">
<%= render @microposts %>
</ul>
<%= will_paginate %>
我的_micropost.html.erb岁生日是这样的:
<li>
<span class="title"><%= micropost.title %></span>
<span class="website"><%= link_to micropost.website, micropost.website %></span>
<span class="content"><%= micropost.content %></span>
<span class="timestamp">
Posted <%= time_ago_in_words(micropost.created_at) %> ago.
</span>
</li>
我不知道这个案子有什么问题.如果我把@设置在micropost.website之前,它会给我一个错误undefined method `website' for nil:NilClass
有人能帮我吗(我是RoR初学者)?
费边