# File Column has me stumped

**URL:** <https://www.ruby-forum.com/t/file-column-has-me-stumped/96265>\
**Category:** Rails\
**Created:** [June 27, 2006, 8:06pm UTC](https://www.ruby-forum.com/t/file-column-has-me-stumped/96265 "2006-06-27T20:06:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasbur](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ce7236/32.png) [@jasbur](https://www.ruby-forum.com/u/jasbur)\
**Post date:** [June 27, 2006, 8:06pm UTC](https://www.ruby-forum.com/t/file-column-has-me-stumped/96265/1 "2006-06-27T20:06:31Z")

</div>

I have an existing entry in my DB under the “users” table that has a  
column name “pic”. I have a file column field when a new user signs up,  
and it work great. I am now trying to give existing users the ability to  
add or change their “pic”. But, no matter what I do the entry comes up  
blank. Here’s what I have so far:

View:  
\<%= start\_form\_tag ({:action =\> ‘settings\_save’, :id =\> @user.id},  
:multipart =\> true) %\>  
\<%= error\_messages\_for ‘user’ %\>

\<%= file\_column\_field "user", "pic" %\>

\<%= submit\_tag "Change" %\> \<%= end\_form\_tag %\>

controller:  
def settings\_save  
@user = User.find(params[:id])  
@user.update\_attribute(“pic”, params[:pic])  
end

In the log:  
Parameters: {“user”=\>{“pic\_temp”=\>"", “pic”=\>#\<File:/tmp/CGI11901.1\>},  
“commit”=\>“Change”, “action”=\>“settings\_save”, “id”=\>“9”,  
“controller”=\>“account”}

It seems the variable is not being passed correctly. Any ideas?

---

<div class="post-metadata">

**Author:** ![jasbur](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ce7236/32.png) [@jasbur](https://www.ruby-forum.com/u/jasbur)\
**Post date:** [June 27, 2006, 8:29pm UTC](https://www.ruby-forum.com/t/file-column-has-me-stumped/96265/2 "2006-06-27T20:29:39Z")

</div>

first, sorry my english…

I think that you must upload the new image, there single you change the  
path  
but in the folder nothing is modified and been original the greetings

Juan P.

2006/6/27, Jasbur [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![jasbur](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ce7236/32.png) [@jasbur](https://www.ruby-forum.com/u/jasbur)\
**Post date:** [June 27, 2006, 8:29pm UTC](https://www.ruby-forum.com/t/file-column-has-me-stumped/96265/3 "2006-06-27T20:29:54Z")

</div>

It appears that in your controller, you want to do:

@user.update\_attribute(“pic”, params[:user][‘pic’]

## Because ‘pic’ is part of the ‘user’ hash. Right?

View this message in context:  
[http://www.nabble.com/File-Column-has-me-stumped-tf1856921.html#a5071442](http://www.nabble.com/File-Column-has-me-stumped-tf1856921.html#a5071442)  
Sent from the RubyOnRails Users forum at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![jasbur](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ce7236/32.png) [@jasbur](https://www.ruby-forum.com/u/jasbur)\
**Post date:** [June 27, 2006, 8:34pm UTC](https://www.ruby-forum.com/t/file-column-has-me-stumped/96265/4 "2006-06-27T20:34:58Z")

</div>

Steve, you’re my new hero! That was it. I was calling a param that  
didn’t exist. Just in case someone searches for this later you forgot  
the last ‘)’ in the code you gave. The final ine is:

@user.update\_attribute(“pic”, params[:user][‘pic’])

Thanks again.

Steve R. wrote:

> It appears that in your controller, you want to do:
> 
> @user.update\_attribute(“pic”, params[:user][‘pic’]
> 
> ## Because ‘pic’ is part of the ‘user’ hash. Right?
> 
> View this message in context:  
> [http://www.nabble.com/File-Column-has-me-stumped-tf1856921.html#a5071442](http://www.nabble.com/File-Column-has-me-stumped-tf1856921.html#a5071442)  
> Sent from the RubyOnRails Users forum at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![jasbur](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ce7236/32.png) [@jasbur](https://www.ruby-forum.com/u/jasbur)\
**Post date:** [June 27, 2006, 8:48pm UTC](https://www.ruby-forum.com/t/file-column-has-me-stumped/96265/5 "2006-06-27T20:48:49Z")

</div>

| Missing paren. Serves me right for typing before thinking :- |
| --- |
| View this message in context: |
| [http://www.nabble.com/File-Column-has-me-stumped-tf1856921.html#a5071782](http://www.nabble.com/File-Column-has-me-stumped-tf1856921.html#a5071782) |
| Sent from the RubyOnRails Users forum at [Nabble.com](http://Nabble.com). |
