Tag: link to

RAILS link_to外部网站,url是用户表的属性,如:@ users.website

我正在一个网站上,允许用户创build一个帐户。 创build用户时的一个属性是用户个人网站。 当我尝试使用这样的用户网站: <%= link_to @user.site, @user.url %> 生成的url是:http: http://0.0.0.0:3000/www.userswebsite.com : http://0.0.0.0:3000/www.userswebsite.com 我认为这是因为link_to的@user部分…但我怎么能得到这个链接到www.userwebsite.com?

如何在rails上添加link_to Ruby的确认消息

我想在link_to函数上添加确认消息。 = link_to 'Reset message', :action=>'reset' ,:confirm=>'Are you sure?' 任何想法,为什么它不工作?

使用Rails link_to发布链接

我有一个链接,我需要提交一个职位请求。 通常情况下,我会使用jQuery并阻止链接的默认行为,然后将表单提交到目标。 这看起来像Rails应该能够帮助我。 果然, link_to方法有一个指定POST http方法的选项: link_to "Profile", 'http://example.com/profile', method: :post 这有效,但我也需要添加2个参数。 我试过了: link_to "Profile", 'http://example.com/profile', method: post, param1: 'value1', param2: 'value2' 这只是将这些参数添加到<a> HTML元素,但没有提交时点击链接: <a rel="nofollow" param1="value1" param2="value2" data-method="post" href="http://example.com/profile">Profile</a> 有没有办法用参数使用link_to或任何其他Rails方法做POST请求? 我正在使用Rails 3.2.9。