Wednesday, May 18, 2022

[FIXED] How can I wrap the table trs with divs on rails?

Issue

view: <table><%= render(:partial => 'item') %></table>

the partial: <div><tr><td>foo</td></tr></div>

I'm expecting to see: <table><div><tr><td>foo</td></tr></div></table>

but I'm seeing: <div></div> <table><tr><td>foo</td></tr></table>

why? and how to achieve my expectation?


Solution

Wrapping tds and trs in divs is incorrect. If you want to add some css or mark a particular td for Capybara, you can use the id or class property inside the td. Something like <td id="td_id" class="td_class">.



Answered By - Gawyn
Answer Checked By - Marilyn (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.