[Nitro] Camel Case does not work for join tables

Aidan Rogers aidan at yoyo.org
Mon Jan 30 06:01:19 EST 2006


Simple patch, as found by vseguip himself - he asked me to post as he  
was short of time.

--- sql.rb      2006-01-30 21:54:55.000000000 +1100
+++ old.sql.rb  2006-01-30 21:59:59.000000000 +1100
@@ -156,7 +156,7 @@
    def join_table_key(klass)
      klass = klass.schema_inheritance_root_class if  
klass.schema_inheritance_child?
-    "#{klass.to_s.split('::').last.underscore.downcase}_oid"
+    "#{klass.to_s.split('::').last.downcase}_oid"
    end
    def join_table_keys(class1, class2)

Aidan

On 30/01/2006, at 9:31 PM, <vseguip at gmail.com> <vseguip at gmail.com>  
wrote:

> I attach a simple test case that demonstrates a bug when using camel
> case as class names in joins_many relationships.
>
>
> here is the output I get
>
>
>
> /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/ 
> errors.rb:94:in
> `check': table ogtc_join_articletocategory has no column named
> articlecamelcase_oid (SQLite3::SQLException)
>         from /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/ 
> sqlite3/statement.rb:70:in
> `initialize'
>         from /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/ 
> sqlite3/database.rb:183:in
> `prepare'
>         from /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/ 
> sqlite3/database.rb:274:in
> `query'
>         from /home/vseguip/Proyectos/og-clean/repo.nitrohq.com/og/ 
> lib/og/store/sqlite.rb:91:in
> `exec'
>         from /home/vseguip/Proyectos/og-clean/repo.nitrohq.com/og/ 
> lib/og/store/sql.rb:487:in
> `join'
>         from (eval):26:in `add_category'
>         from /home/vseguip/Proyectos/og-clean/repo.nitrohq.com/og/ 
> lib/og/collection.rb:123:in
> `push'
>         from test_join_psql.rb:55:in `test_all'
>          ... 11 levels...
>         from /usr/lib/ruby/1.8/test/unit/autorunner.rb:200:in `run'
>         from /usr/lib/ruby/1.8/test/unit/autorunner.rb:13:in `run'
>         from /usr/lib/ruby/1.8/test/unit.rb:285
>         from /usr/lib/ruby/1.8/test/unit.rb:283
> <test_join_psql.rb>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general




More information about the Nitro-general mailing list