1

I am trying to create an xml.builder file that puts links into cells that I am then using a javascript library to render into a table.

Basically I'd like to make the following item a link.

xml.tag!("cell", person.name)

something like this.

xml.tag!("cell", person_path(@person))

Though I know this doesn't work.

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
capcode01
  • 163
  • 1
  • 15

1 Answers1

0

Use the XmlMarkup class:

xml.a(person.name, 'href' => person_path(@person) )

Use .tag with a tag name in parentheses and attributes in curly braces to create a custom tag:

xml.tag!("cell"){xml.a(person.name, 'href' => person_path(@person) )}

References

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265