【问题标题】:link_to in liquid template液体模板中的 link_to
【发布时间】:2014-11-29 06:31:55
【问题描述】:

我是 Ruby on rails 的新手,在使用 Liquid gem 创建 link_to 时遇到问题。我想在电子邮件模板中创建一个链接,例如:

{{link_to 'Submit', profile_accounts_url(:account_id => account.id)}} 

但是,电子邮件模板中未创建链接。请帮我。提前致谢。

【问题讨论】:

    标签: ruby-on-rails ruby


    【解决方案1】:

    我之前没有使用过 liquied,但是你可以在这里查看 link_to 的语法。

    using Liquid variables inside of a liquid tag call

    http://richonrails.com/articles/liquid-templating-engine

    但是,我认为您使用的是 rails 的 link_to 语法,而不是 Liquid 的语法。也许你应该使用类似的东西:

    <%= link_to "Submit", profile_accounts_path(account) %>
    

    这将重定向到显示页面。

    【讨论】:

    • 您好阿德勒,感谢您的帮助。我通过使用这段代码解决了这个问题.. @account.id) %> link).html_safe % > 在 html.erb 中....并将此 {{LINK}} 放入我的电子邮件模板中
    猜你喜欢
    • 2011-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-28
    • 2012-01-02
    • 1970-01-01
    相关资源
    最近更新 更多