This project is archived and is in readonly mode.
Path/URL helpers broken for BigDecimal ID
Reported by Ales Bukovsky | May 13th, 2009 @ 08:17 PM | in 3.x
I'm running a generated tutorial Rails (2.3.2) application on JRuby (1.2.0) against the Oracle 10 database connection via JDBC adapter (0.9.1). The ID column is represented as BigDecimal. None of the pat/URL shortcut helpers (path, edit_path etc.) is working in the templates.
Template has a link:
<%= link_to "Show", book %>
It gives the runtime error:
book_url failed to generate from {:controller=>"books", :action=>"show", :id=>#, title: "Just In Case", author: "Mike Trenton">}, expected: {:controller=>"books", :action=>"show"}, diff: {:id=>#, title: "Just In Case", author: "Mike Trenton">}
Using the full specified link_to with :controller, :action and :id works as far as the BigDecimal ID is converted via to_int.
Note that other functions are affected as well if they rely on teh helpers - like form_for, which I did not find a workaround yet.
Comments and changes to this ticket
-
Ales Bukovsky May 14th, 2009 @ 02:50 PM
There is apparently a problem in the JDBC adapter (0.9.1) implementation for Oracle.
http://www.ruby-forum.com/topic/180358
As result, the integer column is mapped in the Ruby code as a BigDecimal. With the workaround mentioned in the linked post, the ID is mapped properly as an integer and all problems I've described disappear. I’m not sure why Rails chokes on BigDecimal IDs but I can understand that integer is required. However, the linked discussion also indicates that the URL/path generation worked with Rails 2.2.2 although the ID originating in teh BigDecimal was created as X.X. So there still could be a problem in the Rails URL generation code when BigDecimal ID is given, because in 2.3.2 it just dies with an error.
-
Ales Bukovsky May 14th, 2009 @ 04:33 PM
The typecast issue is now cross-reported in the ActiveRecord JDBC adapter bug tracker as well:
-
Santiago Pastorino February 2nd, 2011 @ 04:35 PM
- State changed from new to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino February 2nd, 2011 @ 04:35 PM
- State changed from open to stale
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>