This post originated from an RSS feed registered with Ruby Buzz
by Leon Katsnelson.
Original Post: Scaffolding XML columns as text area boxes
Feed Title: DB2 on Rails
Feed URL: http://feeds.feedburner.com/DB2OnRails
Feed Description: Agile development for enterprises large and small
The Rails adapter and the Ruby driver for IBM DB2 enable you to take full advantage of the exclusive pureXML capabilities. XML fields are properly handled and also recognized when using migrations. We do not bind the content of XML columns to a specific XML Ruby representation (e.g. REXML) but rather let the user decide what they’d prefer to use, in light also of the fact that mapping to a simple string is often all that is required given the fast XQuery/XPath querying features provided out of the box by DB2.
The scaffolding generator ignores XML fields though. This is due to the fact that the bult-in scaffolding generates form elements for only a few datatypes. For example :time and :binary are excluded, and foreign keys are not handled as well. Users will typically want to handle XML fields in a customized way, for instance, showing only certain elements of the XML document in their forms. However if you wish to enable by default the automatic generation of text area boxes when using scaffolding, you can edit C:\ruby\lib\ruby\gems\1.8\gems\actionpack-1.12.5\lib\action_view\helpers\active _record_helper.rb (or the equivalent on your system) by replacing the to_tag method with the following: