简体   繁体   中英

Rails button_to a external link

我有一个带有用户生成的URL字段的表单,现在我想要在显示页面上通过在正常情况下单击按钮(在链接具有路径的情况下单击一个按钮)来访问此外部URL,我正在执行类似此代码的<%= link_to 'Sign in', new_user_session_path, class: "btn sign-home-btn" %> ,但是这里的链接是由用户生成的,并且是外部的

Put the url address in the second argument of the link_to. Like so:

<%= link_to 'External Url', @external_url, class: "btn sign-home-btn" %>

The link_to method just creates the html for a link. The path can be whatever you want it to be.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM