Table name ending in ie

I am new to ruby I tried the following connecting to an Oracle XE
instance.

CREATE TABLE test (
id NUMBER(10) NOT NULL,
title VARCHAR2(60),
author NUMBER(20),
PRIMARY KEY (id)
);

CREATE SEQUENCE test_seq;

Set the following in \config\environment.rb
ActiveRecord::Base.pluralize_table_names = false

Set the database connection in \config\database.yml

Ran ruby script/generate scaffold Test

Ran ruby script/server

Everything worked fine

Repeated the above with the table name and sequence name set to recipie

and got the error

uninitialized constant Recipy

Is this anything to do with pluralisation and table name ending in IE?

You could try it spelled as ‘recipe’ and see what you get.

On 9/12/06, Paul F. [email protected] wrote:


Posted via http://www.ruby-forum.com/.

  • Nic

Nic W. wrote:

You could try it spelled as ‘recipe’ and see what you get.

On 9/12/06, Paul F. [email protected] wrote:


Posted via http://www.ruby-forum.com/.

  • Nic

Thanks Nic

Whilst I acknowledge my dyslexia!! The fundamental problem is still
there, change my misspelling of recipie with what I am to Ruby… newbie
and you get the same result. Therefore the original question is still
valid what happens when table names end in IE.

Right, at the top of your class definition (model file) add:
set_table_name “recipes”. In my example, I assume the name of your
table in the Oracle database is ‘recipes’.

Paul F. <rails-mailing-list@…> writes:

Thanks Nic

Whilst I acknowledge my dyslexia!! The fundamental problem is still
there, change my misspelling of recipie with what I am to Ruby… newbie
and you get the same result. Therefore the original question is still
valid what happens when table names end in IE.

There are 2 possibilities.

The first is to tell Rails how to pluralise ‘newbie’ correctly in your
environment.rb (it has comments telling you how)

The second is to use set_table_name in your model to explicitely tell
Rails
which table to use for it (documentation has all the gossip about that
function)

Don’t worry, Rails is plenty flexible enough in that area

Gareth