# Automatizzare galleria web

**URL:** <https://www.ruby-forum.com/t/automatizzare-galleria-web/138387>\
**Category:** IT\
**Created:** [May 22, 2008, 2:42pm UTC](https://www.ruby-forum.com/t/automatizzare-galleria-web/138387 "2008-05-22T14:42:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![spitfire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@spitfire](https://www.ruby-forum.com/u/spitfire)\
**Post date:** [May 22, 2008, 2:42pm UTC](https://www.ruby-forum.com/t/automatizzare-galleria-web/138387/1 "2008-05-22T14:42:55Z")

</div>

In una app web che gestisco sono presenti molte foto che vengono gestite  
con il plugin attachement\_fu.  
Usando le potenzialitÃ di script/runner combinandolo con uno script bash  
volevo far in modo che tutti i file immagine (molti!!) vangano  
processati da un metodo sel della classe image.  
Il mio problema Ã¨ passare i parametri per la creazione dell’immagine.

def self.prova(url,event)  
image = [{“upload\_data” =\> url}]  
i = Image.create(image)  
g = Gallery.new  
g.image\_id = i.id  
g.event\_id = event  
g.save  
end

che sarÃ eseguito da script/runner Image.prova’“path/to/image”,“1”)

l’associazione fra i modelli Ã¨ image 1 === \* Gallery \* === 1 event

Lo script sh sara un ciclo for che scandisce il risultato del comando ls  
di unix
