On Wed, Mar 25, 2009 at 10:27 AM, Guillaume Desrat <[email protected]> wrote: > > Hi, > > I think I've found where the problem is. > > In the file lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.1/lib/ > jdbc_adapter/jdbc_oracle.rb, there's this : > > module JdbcSpec > ... > module Column > ... > private > def simplified_type(field_type) > case field_type > when /^number\(1\)$/i : :boolean > when /char/i : :string > when /float|double/i : :float > when /int/i : :integer > when /num|dec|real/i : @scale == > 0 ? :integer : :decimal > when /date|time/i : :datetime > when /clob/i : :text > when /blob/i : :binary > end > end > end > end > > When I read my model columns, both integer and number(x,0) Oracle > columns report as following : > > #<ActiveRecord::ConnectionAdapters::JdbcColumn:0x18af9c0 > @precision=nil, @limit=nil, @sql_type="NUMBER", @name="id", > @type=:decimal, @scale=nil, @null=false, @primary=true, @default=nil> > > As @scale is nil and not 0, the simplified_type returned is :decimal, > not :integer. > > > The corresponding case line : > when /num|dec|real/i : @scale == > 0 ? :integer : :decimal > should be replaced by : > when /num|dec|real/i : (@scale.nil? || > @scale == 0) ? :integer : :decimal > > > This works fine for me. If it does for you, could you please open an > issue so that the next version includes it ?
Guillaume, merci bien pour votres enquêtes. I can certainly make the fix, but if possible it would be nice to have an Oracle test to verify the problem and ensure we don't regress. Can you tell me how the column in your database is set up so we can create a test case? Cordialement, /Nick --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

