Repost - Can one edit the file that generates the scaffoldin


#1

I am reposting this because not only am I VERY interested in the
answer but because I think it would also be useful to many, many people.

We kind of have a house-style here, so it would be nice if the
generated scaffold.css would accommodate that. My questions are?

Is it possible?

Is it safe?

How?

bruce


#2

bruce balmer wrote:

I am reposting this because not only am I VERY interested in the
answer but because I think it would also be useful to many, many people.

We kind of have a house-style here, so it would be nice if the
generated scaffold.css would accommodate that. My questions are?

Is it possible?

Is it safe?

How?

bruce

Yes, you can do it, but doing so will give you a non-standard rails
install which will probably get tromped on by the next release.

A better solution would be to make your own generator for your own code
and keep it separate from the rails version. I think there is some info
about making new generators in the Rails Wiki.


#3

I think I understand what you’re asking. You want the generator to to
use
your styles for the scaffold.css. I would think by changing the:

ruby\lib\ruby\gems\1.8\gems\rails-
1.0.0\lib\rails_generator\generators\components\scaffold\templates\styles.css

file that’s what would get pulled down.

Michael T.


#4

Kevin and Michael:

Thanks to both of you. What a great community. Nice to hang around
people far ahead of me. I help others on the list where I can, to
payback you guys for the help you give me.

Thanks again.

bruce


#5

Just tested it and sure enough it workies. I do not know if that’s how
it
should be done.

Michael T.


#6

Michael T. wrote:

I think I understand what you’re asking. You want the generator to to
use your styles for the scaffold.css. I would think by changing the:

ruby\lib\ruby\gems\1.8\gems\rails-1.0.0\lib\rails_generator\generators\components\scaffold\templates\styles.css

file that’s what would get pulled down.
Am I not right in thinking that you could override that file alone in
the vendor/ directory? If you made a template scaffold file at
vendor/rails/railties/lib\rails_generator\generators\components\scaffold\templates\styles.css

with nothing else in the path, wouldn’t that get used in preference to
the one in the gems/ directory, allowing you to override it on an
app-by-app basis?

Perhaps someone could try this - I’m away from my dev box at the moment.