How/where to load initial data?

Hello,

I’ve got a got a question about how and where to load initial data that
is necessary in order to make the website work (menu structure, page
contents, …)

I know it’s preference and everybody can do it as s/he wants but I just
wanna know if there’s any convention or something like that.

First of all, how do I normally load necessary data as mentioned above?
Put it in a fixture and load it while migrating or type it directly into
the migration?

Secondly what about data that is not needed to run the make the
application work but makes my life easier (e.g. a user account so I
don’t have to register myself each time after resetting the migrations)?

Thanks,
Hans

Another question about where it is supposed to be located
conventionally: Where should I put translations? I found many different
locations on the net…

lib/locale?
lib/locales?
config/locale?
config/locales?

I just wanna stick to the “convention over configuration” thing, that’s
why I’m asking. Is there any website that has alle these convention
information by the way?

Thanks

Heinz S. wrote:

Hello,

I’ve got a got a question about how and where to load initial data that
is necessary in order to make the website work (menu structure, page
contents, …)

I know it’s preference and everybody can do it as s/he wants but I just
wanna know if there’s any convention or something like that.

First of all, how do I normally load necessary data as mentioned above?
Put it in a fixture and load it while migrating or type it directly into
the migration?

Data does not belong in migrations, and fixtures aren’t great for this
either. I would advise loading it from a separate file. The Seed-Fu
plugin might be helpful.

Secondly what about data that is not needed to run the make the
application work but makes my life easier (e.g. a user account so I
don’t have to register myself each time after resetting the migrations)?

Same answer, I suppose.

Thanks,
Hans

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Thanks, I’ll have a look at that plugin!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs