Re: [jruby-user] Re: Error 'uninitialized constant Arel::Visitors::SQLite' with rails
Karol Bucek <[email protected]>
| Newsgroups | gmane.comp.lang.jruby.user |
|---|---|
| Message-ID | <CAOcitDKzF8pakXZy8=+C-vC0Fb=qzOFE7G9W1UtstmUY4FshZg@mail.gmail.com> |
Thought I pop in ... Christian has given some great advise but there's a
few "misleading" ones as well - let me explain :
Latest activerecord-jdbcxxx gems 1.3.x (although new) work with Rails 2.3
... I would actually highly recommend using 1.3, if there are issues
downgrade to 1.2.
That being said, you should not expect them to work with every Rails 2.3.x
version that was out there ... but somehow the "latest" one(s).
Without Bundler you will need to "cleanup" your gems - esp. make sure
there's no Rails gems of any other versions than the desired 2.3.x
(activesupport, activerecord etc.)
Than install the AR-JDBC gems with --ignore-dependendies (it depends on
activerecord >= 2.2 but that simply causes rubygems to fetch the latest
activerecord gem) :
gem ins activerecord-jdbc-adapter activerecord-jdbcsqlite3-adapter
--ignore-dependencies
One more thing is JRuby ... there's been some AR-JDBC related issues along
the 1.7.x line - so again do not expect all to work with 1.7.0 but it sure
will just fine with latest.
Do not forget to force JRuby 1.7 it into --1.8 mode if needed (since it
defaults to --1.9 since 1.7) ... on the other hand I also expect JRuby
1.6.8 to work as well just fine.
One thing that limits you very much is that you seem to be "stucked" on
what NetBeans provides ... unfortunately the RoR plugins have not been
catching up.
It's usable (I'm actually using it but only the editor - no related Ruby
tooling) but it will certainly be tricky to find out the correct versions
on JRuby/Rails that work.
Hope some of that is useful, CHEERS!
On Mon, Sep 8, 2014 at 8:43 AM, Christian MICHON <[email protected]
> wrote:
> 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
>