[#376274] Best Linux Distro for Ruby? — Nick Hird <boondox@...>

What are some of the better linux distro's for ruby development? I know

15 messages 2011/01/02

[#376329] Is singleton class of an object already created? — Samnang Chhun <samnang.chhun@...>

I would like to know is there any ways to check is singleton class of an

12 messages 2011/01/04

[#376333] Threading in ruby — "Vishnu I." <pathsny@...>

Hi

13 messages 2011/01/04
[#376335] Re: Threading in ruby — Robert Klemme <shortcutter@...> 2011/01/04

On Tue, Jan 4, 2011 at 8:41 AM, Vishnu I. <pathsny@gmail.com> wrote:

[#376339] ripl - an irb alternative - 0.3.0 released — ghorner <gabriel.horner@...>

ripl, a light modular alternative to irb, has reached 0.3.0. ripl

32 messages 2011/01/04

[#376382] Class Initialization? — Kedar Mhaswade <kedar.mhaswade@...>

I have a class and two class methods: self.encode and self.decode. The

14 messages 2011/01/05
[#376385] Re: Class Initialization? — Andrew Wagner <wagner.andrew@...> 2011/01/05

On Wed, Jan 5, 2011 at 9:33 AM, Kedar Mhaswade <kedar.mhaswade@gmail.com>wrote:

[#376388] Petition to add Metasploit Project as Ruby success story — Christian Kirsch <Christian_Kirsch@...7.com>

I noticed the Ruby success stories on the Ruby website. I would like to mak=

10 messages 2011/01/05

[#376453] Block variable - How is it read in English? — SW Engineer <abder.rahman.ali@...>

Following the "Ruby on Rails Tutorial", and under section "6.1.1

16 messages 2011/01/06

[#376574] Best way for Array#find+transform ? — "Jonas Pfenniger (zimbatm)" <jonas@...>

There is a pattern that I'm using quite regularly, but I'm not

17 messages 2011/01/08
[#376575] Re: Best way for Array#find+transform ? — Anurag Priyam <anurag08priyam@...> 2011/01/08

> I know I can come up with a new method on Array that would shorten this t=

[#376576] Re: Best way for Array#find+transform ? — Anurag Priyam <anurag08priyam@...> 2011/01/08

> paths.map{|path| File.join(path, filename)}.select{|name| File.exist?(path)}

[#376577] Re: Best way for Array#find+transform ? — "Jonas Pfenniger (zimbatm)" <jonas@...> 2011/01/09

2011/1/8 Anurag Priyam <anurag08priyam@gmail.com>:

[#376579] Re: Best way for Array#find+transform ? — David J. Hamilton <groups@...> 2011/01/09

Excerpts from Jonas Pfenniger (zimbatm)'s message of Sat Jan 08 16:05:05 -0800 2011:

[#376586] Re: Best way for Array#find+transform ? — "Jonas Pfenniger (zimbatm)" <jonas@...> 2011/01/09

2011/1/9 David J. Hamilton <groups@hjdivad.com>:

[#376606] Re: Best way for Array#find+transform ? — David J. Hamilton <groups@...> 2011/01/10

Excerpts from Jonas Pfenniger (zimbatm)'s message of Sun Jan 09 04:08:10 -0800 2011:

[#376680] Parallel Assignments and Elegance/Complexity Ratio. — Kedar Mhaswade <kedar.mhaswade@...>

In SICP, I read that "Programs should be written for people to read, and

15 messages 2011/01/11
[#376697] Re: Parallel Assignments and Elegance/Complexity Ratio. — Josh Cheek <josh.cheek@...> 2011/01/11

On Tue, Jan 11, 2011 at 8:29 AM, Kedar Mhaswade <kedar.mhaswade@gmail.com>wrote:

[#376682] JRuby 1.6.0.RC1 released — Thomas E Enebo <tom.enebo@...>

The JRuby community is pleased to announce the release of JRuby 1.6.0.RC1.

14 messages 2011/01/11

[#376744] Case statements - Just beautification — flebber <flebber.crue@...>

I just want to clarify case statements the name after the word case is

10 messages 2011/01/12

[#376792] Ruby is interpreted and scripting language? — Sai Babu <sateesh.mca09@...>

I am ruby fresher.

16 messages 2011/01/13

[#376855] Retrieving and copying element from array — Simon Harrison <simon@...>

If I have an array like this:

11 messages 2011/01/13

[#376898] What are your ruby rough cuts ? — "Jonas Pfenniger (zimbatm)" <jonas@...>

Hi rubyists,

32 messages 2011/01/14
[#376930] Re: [poll] What are your ruby rough cuts ? — David Masover <ninja@...> 2011/01/15

On Friday, January 14, 2011 07:34:04 am Jonas Pfenniger (zimbatm) wrote:

[#376937] Re: What are your ruby rough cuts ? — Joseph Lenton <jl235@...> 2011/01/15

David Masover wrote in post #975080:

[#376959] Why Quby? (was Re: What are your ruby rough cuts ?) — David Masover <ninja@...> 2011/01/15

On Saturday, January 15, 2011 04:42:58 am Joseph Lenton wrote:

[#377020] Obscure syntax error — Rolf Timmermans <molfie@...>

Hi all,

16 messages 2011/01/17

[#377052] Calling by Reference - Two Questions — Mike Stephens <rubfor@...>

I know I'm not the first person to get stumped by how to get Ruby to

15 messages 2011/01/18

[#377072] The most recommended way of naming methods in Ruby — Edmond Kachale <edmond.kachale@...>

Rubists,

14 messages 2011/01/18
[#377082] Re: The most recommended way of naming methods in Ruby — Phillip Gawlowski <cmdjackryan@...> 2011/01/18

On Tue, Jan 18, 2011 at 9:16 AM, Edmond Kachale

[#377121] Improving performance of hash math — dblock <dblockdotorg@...>

I am trying to improve performance of Euclidian distance between two

13 messages 2011/01/19

[#377226] Totally lost in learning Ruby — Hilary Bailey <my77elephants@...>

This is my second attempt to understand Ruby. I completely read 1)

61 messages 2011/01/21
[#378239] Re: Totally lost in learning Ruby — Hilary Bailey <my77elephants@...> 2011/02/08

Hi everybody,

[#378246] Re: Totally lost in learning Ruby — Robert Klemme <shortcutter@...> 2011/02/08

On Tue, Feb 8, 2011 at 3:16 AM, Hilary Bailey <my77elephants@gmail.com> wro=

[#377236] using gems installed via 'sudo gem install' — "Piotr S." <thisredoned@...>

I've installed ruby-opengl through sudo gem install because there were

15 messages 2011/01/21

[#377362] pg gem 0.10.1 wth Ruby 1.9.2 does not work with method @pg_conn.exec_prepared(stmt_name, parameters) — Zeno Davatz <zdavatz@...>

Hi

9 messages 2011/01/24

[#377388] The finer points of postfix conditionals. — Jon Leighton <j@...>

Hi,

13 messages 2011/01/24

[#377411] Obtain data from .csv — Kamarulnizam Rahim <niezam54@...>

Sample of .csv file:

19 messages 2011/01/25

[#377609] why is overloading invalid in ruby. — Ted Flethuseo <flethuseo@...>

I don't understand why when I try to overload I get an error. Can I

36 messages 2011/01/27

[#377645] If you had the choice between Ruby & Groovy — Noah Cutler <sit1way@...>

Hey All.

15 messages 2011/01/28

[#377650] IDE? — <johan.tempelman@...>

Hi,

13 messages 2011/01/28

[#377703] Zlib::GzipReader and multiple compressed blobs in a single stream — Jos Backus <jos@...>

Hi,

11 messages 2011/01/28

[#377761] New to programming AND new to Ruby — "Cassandra K." <cassandra.k@...>

Hello. I am trying to teach myself Ruby. I have no background in

13 messages 2011/01/31

[#377785] 2011: Which Ruby books have you read? And which would you recommend? — "Aston J." <azzzz@...>

I know there are a lot of threads about books, but some of them are as

16 messages 2011/01/31

[#377800] How to know the exit status within at_exit() block? — Iñaki Baz Castillo <ibc@...>

Hi, my program invokes "exit true" or "exit false" and I want to catch

17 messages 2011/01/31

Rails: Problem with test-environment and mysql2 database

From: vivec manavortex <ilikerubies@...>
Date: 2011-01-26 11:41:54 UTC
List: ruby-talk #377510
Hi list,
this is the first time I am posting here, so please be gentle ;)

I have spent all day yesterday googeling and reading stuff, and the
only post I found having the same problem as I did was replied to
by the owner with "fixed it, was something in my database.yml", what
didn't help me the slightest bit, so please help me, ruby-wan, you are
my last hope.

I have a Rails-project (OS X Snow Leopard, Rails 3.0.3, all gems are up
to date, although we got the test reproduced on another unix) that I am
supposed to test. It's pretty simple, a basic implementation of an
access control system using the devise gem.


My problem here is that I can't run any tests. The test I try to run
is the auto-generated test for my autogenerated dummy-controller that
doesn't do anything, and that doesn't work for, stacktrace:

/Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:62:in 
`establish_connection': test database is not configured 
(ActiveRecord::AdapterNotSpecified)
	from 
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in 
`establish_connection'
	from 
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/railtie.rb:59
	from 
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:36:in 
`instance_eval'
	from 
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:36:in 
`execute_hook'
	from 
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:26:in 
`on_load'
	from 
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/railtie.rb:57
	from 
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:25:in 
`instance_exec'
	from 
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:25:in 
`run'
	from 
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:50:in 
`run_initializers'
	from 
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:49:in 
`each'
	from 
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:49:in 
`run_initializers'
	from 
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:134:in 
`initialize!'
	from 
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:77:in `send'
	from 
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
	from /Users/vivec/Documents/RubyWorkspace/psmt/config/environment.rb:5
	from 
/Users/vivec/Documents/RubyWorkspace/psmt/test/unit/../test_helper.rb:2:in 
`require'
	from 
/Users/vivec/Documents/RubyWorkspace/psmt/test/unit/../test_helper.rb:2
	from 
/Users/vivec/Documents/RubyWorkspace/psmt/test/unit/dummy_test.rb:1:in 
`require'
	from /Users/vivec/Documents/RubyWorkspace/psmt/test/unit/dummy_test.rb:1

Okay, so my test database isn't configured, so let's configure it? Not
that simple, for I simply can't.

Here's the database.yml:

development:
   adapter: mysql2
   encoding: utf8
   reconnect: false
   database: psmt_dev
   pool: 5
   username: root
   password:
   socket: /var/run/mysqld/mysqld.sock

test:
   adapter: mysql2
   encoding: utf8
   reconnect: false
   database: psmt_test
   pool: 5
   username: root
   password:
   socket: /var/run/mysqld/mysqld.sock

When I try to do anything rakely in development mode, everything is
fine. MySql is up and running, the databases both exist. I can do
a rake db:migrate to the database psmt_dev and, if I change the db
in development mode to psmt_test, I can migrate to that too. (I
did that and hoped it would solve the problem, it did not.)
As soon as I try to do anything rakely in test mode, it crashes -
there seems to be a problem dumping the database:

$ rake db:test:prepare --trace
(in /Users/vivec/Documents/RubyWorkspace/psmt)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:429
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in 
`invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in 
`synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in 
`invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in 
`invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in 
`invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in 
`invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in 
`synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in 
`invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:460
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in 
`invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in 
`synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in 
`invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in 
`standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in 
`standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

I chased the bug deep down to databases.rake:429, and there it says:
task :purge => :environment do
       abcs = ActiveRecord::Base.configurations
       case abcs["test"]["adapter"]
       when /mysql/

and the problem seems to be with the case-statement, there something
is a nil value (and most likely it is the "adapter" value in "test"?).
The adapter value is set in my database.yml, and everything is great
as long as I stay to the development environment - but I need to
get those tests working.

In my theory, the problem is that, to execute a test, Rails wants to
have the test environment running and therefore the test-database dumped
and re-filled from the fixtures. The explosions happen during the dump-
procedure, so I guess, it's not my fault.

Does anyone have any idea how I get this fixed? I'm helpless.

greetings

In This Thread

Prev Next