# How can you get a variable from the view into the model

**URL:** <https://www.ruby-forum.com/t/how-can-you-get-a-variable-from-the-view-into-the-model/109566>\
**Category:** Rails\
**Created:** [July 16, 2007, 10:34pm UTC](https://www.ruby-forum.com/t/how-can-you-get-a-variable-from-the-view-into-the-model/109566 "2007-07-16T22:34:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fernando](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/779978/32.png) [@fernando](https://www.ruby-forum.com/u/fernando)\
**Post date:** [July 16, 2007, 10:34pm UTC](https://www.ruby-forum.com/t/how-can-you-get-a-variable-from-the-view-into-the-model/109566/1 "2007-07-16T22:34:12Z")

</div>

Hi,

I am using the attachment\_fu plugin to generate thumbnails and save  
images into the file system. I want to create a folder in public/  
images and then save all the images including thumbanils there.  
So far I can create a new folder and save images. However, I cannot  
save the images into a specific subfolder.  
I want to create a variable and set it as using a text field in the  
view, then upload files into a folder named after whatever is in the  
text field. using attachemtn\_fu the save path is set using:

def full\_filename(thumbnail = nil)  
file\_system\_path = (thumbnail ? thumbnail\_class :  
self).attachment\_options[:path\_prefix].to\_s  
File.join(RAILS\_ROOT, file\_system\_path,  
\*partitioned\_path(thumbnail\_name\_for(thumbnail)))  
end

Does anyone know how I can get a variable from the view inbetween  
‘attachment\_options[:path\_prefix]’ and ‘to\_s’ in the model?

kind regards

Tim Fernandez
