Model's table names


#1

Hello, I would like to have all the tables referenced by my engine
prefixed with “something”

I can’t use the set_table_name function because unfortunately this break
fixtures usage (fixtures are not found if fixture name != model name !=
table name)

I’ve tried to have a look inside engines code but I’m not (yet ;-)) able
to touch something without the risk of injecting bugs.

is there a patch somewhere ?

Thanks


#2

There is preliminary support (see
ActiveRecord::Base#wrapped_table_name) for prefixes in the latest
(1.1) release of the Engines plugin, although I’m not sure how they’ll
interact with the fixtures method. One thing to bear in mind is that
the testing extensions provided with Engines let you specify the class
and table names for your fixtures (see the login/user engines for an
example of one way to achieve this, although I don’t believe that what
I’ve done there is perfect).

However, as I said at the start, support is basic at the moment - the
relevant ticket is http://dev.rails-engines.org/tickets/67, if you can
contribute in any way, please re-open it and add your debug
info/patches there.

It’s a bit of a tangled web with prefixes, migrations and fixtures all
influencing the right table name and affecting the class inference
mechanisms.

My best advice is to go ahead and change the engines code until you
have something you feel works, and then submit the diff as a patch,
where it will be double-checked and tested :slight_smile:

  • james

On 4/6/06, Nuno removed_email_address@domain.invalid wrote:

is there a patch somewhere ?

Thanks


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


engine-users mailing list
removed_email_address@domain.invalid
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org

  • J *
    ~

#3

James A. wrote:

There is preliminary support (see
ActiveRecord::Base#wrapped_table_name) for prefixes in the latest
(1.1) release of the Engines plugin, although I’m not sure how they’ll
interact with the fixtures method. One thing to bear in mind is that
the testing extensions provided with Engines let you specify the class
and table names for your fixtures (see the login/user engines for an
example of one way to achieve this, although I don’t believe that what
I’ve done there is perfect).

I’ve had a look to these source files, seems to be fine for me… I’ll
give it a try

My best advice is to go ahead and change the engines code until you
have something you feel works, and then submit the diff as a patch,
where it will be double-checked and tested :slight_smile:

Ahem, why not ? But I’ve not finished the 1st chapter of “Ruby for the
Super Super newbies” :slight_smile: