RAILS link_to外部站点,url是用户表的属性,如:@ users.website [英] RAILS link_to external site, url is attribute of user table, like: @users.website
问题描述
我正在开发一个允许用户创建帐户的网站。创建用户时的一个属性是用户个人网站。当我尝试使用这样的用户网站时:
I'm working on a website that allows users to create an account. One of the attributes when creating a user is a users personal website. When I try to use the users website like this:
<%= link_to @user.site, @user.url %>
生成的网址是: http://0.0.0.0: 3000 / www.userswebsite.com
我认为这是因为link_to的@user部分......但是我怎么能得到这链接到www.userwebsite.com?
I think this is because of the @user part of the link_to... but how can I get this to link to www.userwebsite.com ?
推荐答案
看起来你需要在你的链接上粘贴协议。例如。你的数据库中有www.userswebsite.com,它应该是 http://www.userswebsite.com
Looks like you need to stick the protocol on your link. E.g. you have www.userswebsite.com in your database, it should be http://www.userswebsite.com
这篇关于RAILS link_to外部站点,url是用户表的属性,如:@ users.website的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!