The way to avoid table name clashes *at the moment* is to provide the
developer with ways of configuring the table names each Engine uses.
Look at the schema.rb file in the LoginEngine, along with the
lib/login_engine.rb file to see what I''m talking about (
LoginEngine.config(:user_table) ==> "users" ).
An extended role-based user system I have on the back burner has more
tables - users, permissions, roles, and the join tables between, each
of whose actual name in the DB can be set by the developer in
/config/environment.rb in the same way that the :salt value is in the
Engines intro video.
What might be lacking currently is making the defaults known to
developers using engines, and possibly detecting any clashes before
doing anything clever with DB schemas/migrations, but I think the
latter is probably being a bit too clever for now.
Again, it''s important to note that with the LoginEngine example,
I''m
really using the schema.rb mechanism for something it wasn''t actually
intended to do. From my hacker point of view, it''s a shortcut that
I''ve cheekily hijacked for getting your tables created quickly.
On 11/4/05, Jonathan Younger
<daikini-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Have some more engine pondering :)
>
> Let''s say that I''d like to combine three engines into a
single
> application. A wiki engine, a blog engine and a photo gallery engine.
> The wiki engine and the blog engine may have tables/models called
> "pages" while the blog engine and the photo gallery engine may
have
> tables/models called "comments". Unless the structure of these
tables/
> models are exactly the same there is going to be a conflict between
> them.
>
> I''m wondering what the best way to handle this would be. Table
name
> prefixes?
>
> -Jonathan
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>