简体   繁体   English

Ruby on Rails-无法在函数中呈现变量

[英]Ruby on Rails - can't render a variable in a function

I have some HAML code like this: 我有一些这样的HAML代码:

.clearfix
  =f.label t("labels.shortened_urls.fqdn_url")
  =f.url_field :fqdn_url, {:readonly => true}
.span1
  =link_to((t "links.shortened_urls.view"), f.object.fqdn_url(true), :target => :_blank)
  .clippy-container=clippy(fqdn_url,"#ffffff")

it does nto render because of the last line. 由于最后一行,它不会渲染。 If I change the last line to a simple string like this, it will work: 如果我将最后一行更改为这样的简单字符串,它将起作用:

.clippy-container=clippy("test","#ffffff")

but I am not certain of the variables syntax that I need to use and I tried this: 但是我不确定我需要使用的变量语法,因此尝试了以下操作:

.clippy-container=clippy(fqdn_url,"#ffffff")

or this: 或这个:

.clippy-container=clippy(:fqdn_url,"#ffffff")

but none of them work. 但它们都不起作用。 Any idea how to make it work with that fqdn_url variable? 任何想法如何使其与该fqdn_url变量一起使用?

Thanks! 谢谢!

您尝试过fqdn_url.to_s吗?

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

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