Note that there are some explanatory texts on larger screens.

plurals
  1. POStack overflow exception with Rails 3.2 ActiveRecord
    text
    copied!<p>Having a weird issue with Rails 3.2.1. Working with a legacy database with icky column names and I'm trying to clean them up in my model. The following model works fine in HTML, but responding with JSON or XML throws a <code>stack level too deep</code> error:</p> <pre><code>class Order &lt; ActiveRecord::Base set_table_name 'ordersum' set_primary_key 'ordernbr' alias_attribute 'id','ordernbr' alias_attribute 'customer_id', 'custid' alias_attribute 'shipping_name', 'sname' alias_attribute 'shipping_company','scompany' alias_attribute 'shipping_address1','saddress1' alias_attribute 'shipping_address2','saddress2' alias_attribute 'shipping_city','scity' alias_attribute 'shipping_state','sstate' alias_attribute 'shipping_zip','zip' alias_attribute 'shipping_country','scountry' alias_attribute 'shipping_phone','sphone' alias_attribute 'shipping_method','shipvia' alias_attribute 'subtotal','product' alias_attribute 'shipping', 'freight' alias_attribute 'handling', 'handling' alias_attribute 'total', 'ordertot' alias_attribute 'transaction_id', 'vsTransactionId' alias_attribute 'reference_number', 'vsrefnbr' alias_attribute 'approval_code', 'vsappcode' alias_attribute 'created_on', 'entereddtm' end class OrdersController &lt; ApplicationController respond_to :html, :xml, :json def index @orders = Order.all respond_with @orders end end </code></pre> <p>Order is stack level too deep with no stack trace.</p> <p><strong>Edit #1</strong> Framework/Full trace had 1 item: </p> <p><code>actionpack (3.2.1) lib/action_dispatch/middleware/reloader.rb:70</code></p> <p><strong>Edit #2</strong> Found some additional details after digging. Did a rails console and an <code>Order.find</code> and got the error below. Please note that <code>Order.all</code>works fine.</p> <pre><code>C:\Users\Rich\App&gt;rails console Loading development environment (Rails 3.2.1) irb(main):001:0&gt; Order.find(1) ←[1m←[36mOrder Load (1.0ms)←[0m ←[1mSELECT `ordersum`.* FROM `ordersum` WHERE `ordersum`.`ordernbr` = 1 LIMIT 1←[0m SystemStackError: stack level too deep from C:/ruby/lib/ruby/1.9.1/logger.rb:443 irb(main):002:0&gt; </code></pre>
 

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