Note that there are some explanatory texts on larger screens.

plurals
  1. PORouting error after call to RDF::RDFa::Reader
    text
    copied!<p>I've posted a question relating to this before but it was unclear. I've simplified the code so I can copy it here and have it be as straightforward as possible. I'm still not sure what the best way to debug this may be but here it goes:</p> <p>My 'new' action (could be any really) for a resource (again, can be any):</p> <pre><code>def new RDF::RDFa::Reader.open("http://www.tripadvisor.com/Hotel_Review-g186525-d280839-Reviews-Gerald_s_Place-Edinburgh_Scotland.html") do |r| r.each_statement do |statement| Rails.logger.debug(statement) end end respond_to do |format| format.html { }# new.html.haml format.json { render json: @base_item } format.js end end </code></pre> <p>The page renders fine and the RDF code is run successfully, however, when I refresh the page or try to access anything else, I get the following (substitude 'base_item' with whatever resource I'm trying to access, they all fail with this error):</p> <pre><code>ActionController::RoutingError (private method `redefine_method' called for #&lt;Class:0x000001058527c0&gt;): app/models/base_item.rb:3:in `&lt;class:BaseItem&gt;' app/models/base_item.rb:2:in `&lt;top (required)&gt;' app/controllers/base_items_controller.rb:3:in `&lt;top (required)&gt;' </code></pre> <p>I'm wondering if this is something specific to the rdf gem (which uses nokogiri) or if it is a general routing issue but haven't found a way to test that.</p> <p>Any help appreciated.</p> <p>EDIT: It seems it has to do with the r.each_statement line as if I take that out, things keep working..</p> <p>UPDATE: I haven't been able to reproduce this outside of Rails but I've narrowed it down to an issue with ActiveRecord. I've set up a sample app at <a href="https://github.com/slamorsi/rdfTest" rel="nofollow">https://github.com/slamorsi/rdfTest</a></p> <p>There are two models, Test and TestChild. The error is reproducible if Test and TestChild are related - right now Test has a has_many relationship with TestChild. The root of the app goes to test#index which has sample RDF/RDFa code. If you load the page once then refresh, you'll see the 'redefine method called...' error. If there's no relationship between the models or if no RDF/RDFa statements.each code is executed, everything works fine. I don't know what could possibly cause this.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload