开发者

Rails AutoGenerating Tag IDs

开发者 https://www.devze.com 2023-04-04 12:27 出处:网络
Our QA team uses watir to test our web app. They are requiring that every HTML tag have some kind of id for them to hook on to.

Our QA team uses watir to test our web app. They are requiring that every HTML tag have some kind of id for them to hook on to.

Consider this simple example:

<%= link_to "New Group", new_group_path %>

which generates

<a href="https://localhost/groups/new">New Group</a>

Is there a way for rails to simply to just generate an id for this tag?

In other words, I want the generated HTML to be

<a id="new_group_link" href="https://groups/new">New Group</a>
开发者_运维技巧

without having to manually provide :id => "new_workgroup_link" as one of the html_options to the link_to method.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号