newbie questions - create table and file browser?

Hey Guys,

I am attempting to develop an application for managing my company's workflow doing visual effects for the TV/film industry.

I have a few ruby on rails questions.

1. How can I create a new table in a database without using a migration? (I want to create a new table for every job we do - to keep track of all the versions of the effects and works in progress we do)

2. Is there anyway to browse directories/files on a server using rails?

Any help is greatly appreciated!

Cheers

Adam

Adam Teale wrote:

1. How can I create a new table in a database without using a migration?

SQL. Exact details depend on the RDBMS you are going to use.

(I want to create a new table for every job we do - to keep track of all the versions of the effects and works in progress we do)

This is not a really well thought out idea. The amount of JOINs, UNIONs this invites is nasty, not to mention that it will be an administrative nightmare (glossing over the performance issues this might incur in production).

That's what has_many, has_one, belongs_to, belongs_to_many, etc.. are for, Rails' (or rather ActiveRecord's) relationship methods. Yes, you can do that with the many, many tables you'll have, too, but every single table will need a controller at least, maybe even a model. Not to mention you'll end up having to inherit from a base class for the models. Not very DRY, and not very YAGNI, either.

Have fun maintaining the n+x controllers and possibly models, though.

2. Is there anyway to browse directories/files on a server using rails?

There should be. Ruby (the language Rails is written in) should allow for that, one way or another.

- -- Phillip Gawlowski Twitter: twitter.com/cynicalryan

~ I say, if your knees aren't green by the end of the day, you ought to seriously re-examine your life. -- Calvin

Hi Phillip!

Thanks for replying so quickly.

It's good to know so early on that I have the wrong approach to the tables! I'l read up on ActiveReord

Cheers!