简体   繁体   English

rails 5 tel_to样式问题“给出了错误的参数数量”

[英]rails 5 tel_to styling issue 'wrong number of arguments given'

I am trying to sort out how to style a tel_to link I have. 我试图找出如何设置我拥有的tel_to链接的样式。 It is generated dynamically when an office location is generated. 它是在生成办公地点时动态生成的。

my link as it stands is: 我的链接是:

<%= tel_to @location.tel_number %>

when I try to do the following: 当我尝试执行以下操作时:

<%= tel_to @location.tel_number, :class => 'style_number' %>

I get an argument error that says: 我收到一个参数错误,内容为:

wrong number of arguments (given 2, expected 1)

This is my first time using tel_to, i have read the docs but still can't seem to figure this out. 这是我第一次使用tel_to,我已经阅读了文档,但似乎仍然无法弄清楚。 any assistance here would be greatly appreciated! 在这里的任何帮助将不胜感激!

我认为最好只使用link_to ,这样您就可以访问标准的Rails方法

= link_to @location.tel_number, "tel:#{@location.tel_number}", class: 'some_fancy_class'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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