0

I'd like to a text that looks like:

You created a new User

But what i get is just a plain text:

You crated a new <a href="/link/to/user">User</a>

I'm using public_activity gem to track changes inside my app.

Here is my view:

#app/views/activities/index.html.slim

.panel.panel-default
  .list-group
    - @activities.each do |activity|
    .list-group-item
      = render_activity(activity)
      .pull-right
        = activity.created_at

and how i use the activies:

= t '.log', trackable_name: link_to("User", root_path)

log: 'You created a new %{trackable_name}'

Any help would be great, thanks!

gustavoca
  • 148
  • 12
  • 1
    Helpers output is HTML-escaped by default. To prevent this, you can use `html_safe`: `= t('.log', trackable_name: link_to('User', root_path)).html_safe`. – Marek Lipka Dec 09 '14 at 13:52
  • this didn't work, but i managed to make it work changing "log:" to "log_html:". Thanks for your answer! – gustavoca Dec 09 '14 at 14:21

1 Answers1

0

Try this:

= raw(t('.log', trackable_name: link_to("User", root_path)))
Sibevin Wang
  • 4,480
  • 3
  • 27
  • 27