Exception: PageRecord::MultipleRecords

Inherits:
Exception
  • Object
show all
Defined in:
lib/page_record/errors.rb

Overview

This Exception is raised when the page contains multiple instances of the specfied record type. Use a selector to narrow the search.

<div id='first-table' data-team-id='10'>
    <div data-attribute-for='name'>Ajax</div>
</div>
<div id='second-table' data-team-id='10'>
    <div data-attribute-for='name'>Ajax</div>
</div>

When the following code is executed, the MultipleRecords exception is raised.

TeamPage.find(10)

To fix this, use the #first-table in the selector

TeamPage.find(10, '#first-table')