Rails 3.2 + minitest + sqlite3 :memory: = Fail - ruby-on-rails-3

I'm unable to use the :memory: database with Rails 3.2, sqlite3, and minitest. I have the following in database.yml:
test:
adapter: sqlite3
database: ":memory:"
and get the following error when doing rake minitest
/home/hoffmanc/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.3/lib/active_record/connection_adapters/sqlite_adapter.rb:465:in `table_structure': Could not find table 'apks' (ActiveRecord::StatementInvalid)
(one of my models is named Apk)
Am I missing a step?

Related

Rails upgrade from 5.0.7.1 to 5.1.7 problem

I try upgrading my rails app from 5.0.7.1 to 5.1.7. After rails app:update command rails -v return me 5.1.7, but command rails server return me next error:
.gem/ruby/2.6.8/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:101:in `module:Command': uninitialized constant Rails::Command::Base (NameError)
Did you mean? Base64
What can I do with it?

In Ruby 1.8.7, why does JSON syntax in IRB raise a Syntax, but not in a Rails 3.2.22.1 console?

I'm responsible for maintaining a legacy Ruby on Rails application, and I'm currently testing it on Ruby v1.8.7 (2013-12-22 patchlevel 375). The app is using Rails v3.2.22.1 (a Rails version provided by Rails LTS). I am bumping into a weird syntax issue.
In a vanilla IRB console, the hash rocket syntax for a Hash works as expected, and the JSON syntax for raises a syntax error as expected. However, in a Rails console, the JSON syntax is working just fine, and I can't figure out why it's NOT raising a syntax error.
Any ideas what is going on in the code below?
# in Bash
$ ruby -v
ruby 1.8.7 (2013-12-22 patchlevel 375) [i686-darwin18.2.0]
# in Rails console
Loading development environment (Rails 3.2.22.1)
irb(main):001:0> system "ruby -v"
ruby 1.8.7 (2013-12-22 patchlevel 375) [i686-darwin18.2.0]
=> true
irb(main):002:0> {a: 1} # JSON syntax doesn't trigger SyntaxError
=> {:a=>1}
# loading vanilla IRB *()
irb(main):003:0> system "irb" # loading vanilla IRB
# in vanilla IRB (via Rails console, if that matters)
irb(main):001:0> system "ruby -v"
ruby 1.8.7 (2013-12-22 patchlevel 375) [i686-darwin18.2.0]
=> true
irb(main):002:0> {a: 1} # expected syntax error
SyntaxError: compile error
(irb):2: odd number list for Hash
{a: 1}
^
(irb):2: syntax error, unexpected ':', expecting '}'
{a: 1}
^
from (irb):2
It turned out that the Ruby version set in the .ruby-version was 1.9.3-p551, and that caused Rails to load using Ruby 1.9.3-p551. That wasn't immediately obvious when I got the Ruby version from the system, but checking the Ruby version from within the app revealed the difference.
$ bundle exec rails console
irb(main):001:0> system "ruby -v"
ruby 1.8.7 (2013-12-22 patchlevel 375) [i686-darwin18.2.0]
=> true
irb(main):002:0> RUBY_VERSION
=> "1.9.3"

Ruby on Rails connection SQL Oracle problems

I'm trying to setup SQL Oracle and use active records to migrate db with ruby on rails.
I installed sqldeveloper and created a new connection. Here the first error:
I/O error: The Network Adapeter could not establish the connection
Then I installed instantclient basic, sdk, sqlplus and then two gems:
gem 'ruby-oci8'
gem 'activerecord-oracle_enhanced-adapter'
but I got this error:
LoadError: Could not load 'active_record/connection_adapters/oracle_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.
this is my database.yml:
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
development:
adapter: oracle
database: development
username: nick
password:
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: oracle
database: test
username: nick
password:
production:
adapter: oracle
database: production
username: nick
password:
I wasn't able to find a solution, what can I do?
Update adapter entries as follows:
adapter: oracle
to
adapter: oracle_enhanced

Could not find generator mini_test:install

I expected these generators to be available:
$ rails g
Usage: rails generate GENERATOR [args] [options]
MiniTest:
mini_test:controller
mini_test:helper
mini_test:install
mini_test:mailer
mini_test:model
mini_test:scaffold
So I ran:
$ rails g mini_test:install
But got this error:
Could not find generator mini_test:install.
As for my environment, here is the relevant portion of my Gemfile:
group :test, :development do
gem 'minitest-rails'
end
And the resulting portions of my Gemfile.lock:
minitest (2.12.1)
minitest-rails (0.0.7)
minitest (~> 2.12)
rails (~> 3.1)
I am now in the process of debugging this. I would appreciate any tips. In any case, I will report back.
This is fixed in the 0.1 release of minitest-rails.
https://github.com/blowmage/minitest-rails
According to minitest-rails issue #41 - Generators are not found:
Try the prerelease gem, 0.1.0.alpha. Its a different approach and you'll need to update any existing tests.
I just confirmed that this worked for me:
$ rails g mini_test:install
create test
create test/minitest_helper.rb

thinking_shpinx, sphinx and MacOS X 10.6.7

After installing thinking_sphinx (http://freelancing-god.github.com/ts), and Sphinx (via brew - v.0.9.9-release (r2117) or via latest sources) and setting up ts in Rails3 (Ruby via RVM: ruby-1.9.2-p180 [ x86_64 ], rails 3.0.7) app like:
define_index do
indexes :name
end
and executing rake ts:start or rake ts:index, i permanently get:
ruby: invalid option -/ (-h will show valid options) (RuntimeError)
What the problem?