Re: [jruby-user] Re: Error 'uninitialized constant Arel::Visitors::SQLite' with rails

Christian MICHON <[email protected]>
Newsgroups gmane.comp.lang.jruby.user
Message-ID <CACx2yF9Bf2utA1wOZ6qQshBEwEe0OfyTCit5MzgSUQFoi6r=fw@mail.gmail.com>
Hi,

experiment over: I insist that my 1st answer was the best possible way
forward without changing all your architecture or your software stack...

Demonstration:

1/ install jruby-1.7.0 & install the gems in mode 1.9 (a requirement from
latest activerecord-jdbcsqlite3-adapter)
  - jruby -S jgem ins rails -v 2.3.8
  - jruby -S jgem ins activerecord-jdbcsqlite3-adapter -v 1.3.10
  => note this will install the following 3 gems, actually from rails 4.x
(please note Arel...)
    Fetching: activesupport-4.1.5.gem (100%)
    Fetching: activemodel-4.1.5.gem (100%)
    Fetching: arel-5.0.1.20140414130214.gem (100%)

2/ create a rails 2.3.x app with 1 model and run the db migration
  - jruby -S rails todoapp
  - cd todoapp (change sqlite3 adapter to jdbcsqlite3 in
config/database.yml)
  - jruby script/generate model Task title:string note:text completed:date
  - jruby -S rake db:migrate
  => uninitialized constant Arel::Visitors::SQLite

Suggested fix: install an older version of activerecord-jdbcsqlite3-adapter
(I suggested 1.0.3)

1/ install jruby-1.7.0 & install the gems in mode 1.9 (not a requirement
anymore but to ensure consistency)
  - jruby -S jgem ins rails -v 2.3.8
  - jruby -S jgem ins activerecord-jdbcsqlite3-adapter -v 1.0.3

2/ create a rails 2.3.x app with 1 model and run the db migration
  - jruby -S rails todoapp
  - cd todoapp (change sqlite3 adapter to jdbcsqlite3 in
config/database.yml)
  - jruby script/generate model Task title:string note:text completed:date
  - jruby -S rake db:migrate
==  CreateTasks: migrating
====================================================
-- create_table(:tasks)
   -> 0.0220s
   -> 0 rows
==  CreateTasks: migrated (0.0240s)
===========================================

So there you've a fix: good luck again with your project

;-)



On Mon, Sep 8, 2014 at 6:53 AM, Christian MICHON <[email protected]
> wrote:

> I cannot foretell if rails 3 will work or not. Your code will need a lot
> of rework. Maybe the application is small and you can cope with the upgrade.
>
> But it is usually a good idea to freeze your gems to a specific version in
> time to ensure stability.
>
> I stopped using rails 2 years ago. It was not a good match for my apps and
> i preferred sequel to activerecord, and sinatra to rails.
>
> Maybe the breakage is in the database adaptor rather than in the rails
> version. Rails 2 did not know about bundler so your project does not have a
> Gemfile, right?
>
> What does happen if you replace sqlite by h2? H2 is a java database,
> usable in embedded or network mode. Please google for an adaptor.
>
> I'll try to build a small test case later today to debug this as well.
>
> Good luck.
> On Sep 8, 2014 5:19 AM, "David Bennett" <[email protected]> wrote:
>
>> If you like to put it that way. I all actually did was upgrade Netbeans
>> to 7.4 a while back and then more recently tried to get this old project
>> working. The JRuby is what came with Netbeans. The jdbc was just the
>> default gem.
>>
>> Unless there is a compelling reason, I would prefer to move forward than
>> backward. Is it likely that (say) Rails 3.x would work? I'd rather fix
>> problems moving the project forwards than this kind of wrestling with
>> outdated incompatible versions.
>>
>> --
>> Posted via http://www.ruby-forum.com/.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>


-- 
Christian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.