简体   繁体   中英

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. 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. any assistance here would be greatly appreciated!

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

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

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