E
Emmek On rails
I have the following problem to solve.
I have some logo images in the following directory structure:
/users/a/adam/logos/jdkajsdns.jpg
/users/a/alan/logos/skdjaksxa.jpg
(...)
/users/b/bob(...)
(...)
etc.
(there are also other directories and files in the structure and some
directories are empty; but I'd like to extract just the "branch" with
logo pictures)
Names of directories like "adam", "alan" are users logins in the
database. I need to transform that structure into something like this:
/logos/756/jdkajsdns.jpg
/logos/815/skdjaksxa.jpg
etc.
where 756 is the id of the user 'adam' and the 815 is the id of the user
'alan', etc.
So:
1) It could be possible to bind logins and ids by generating a text file
with pairs of these values from db and to write a script that transforms
the structure using such file. How should the proper ruby script look
like?
2) Is it possible to use script/console in Rails and solve the problem
just inside it?
I have some logo images in the following directory structure:
/users/a/adam/logos/jdkajsdns.jpg
/users/a/alan/logos/skdjaksxa.jpg
(...)
/users/b/bob(...)
(...)
etc.
(there are also other directories and files in the structure and some
directories are empty; but I'd like to extract just the "branch" with
logo pictures)
Names of directories like "adam", "alan" are users logins in the
database. I need to transform that structure into something like this:
/logos/756/jdkajsdns.jpg
/logos/815/skdjaksxa.jpg
etc.
where 756 is the id of the user 'adam' and the 815 is the id of the user
'alan', etc.
So:
1) It could be possible to bind logins and ids by generating a text file
with pairs of these values from db and to write a script that transforms
the structure using such file. How should the proper ruby script look
like?
2) Is it possible to use script/console in Rails and solve the problem
just inside it?