# Attachment\_fu, many pictures to one user

**URL:** <https://www.ruby-forum.com/t/attachment-fu-many-pictures-to-one-user/128306>\
**Category:** Rails\
**Created:** [February 6, 2008, 4:52pm UTC](https://www.ruby-forum.com/t/attachment-fu-many-pictures-to-one-user/128306 "2008-02-06T16:52:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaizerkaizer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/45deac/32.png) [@kaizerkaizer](https://www.ruby-forum.com/u/kaizerkaizer)\
**Post date:** [February 6, 2008, 4:52pm UTC](https://www.ruby-forum.com/t/attachment-fu-many-pictures-to-one-user/128306/1 "2008-02-06T16:52:06Z")

</div>

Hi, again.

about Attachment\_fu, I wanted to add MANY pictures (portfolios-table) to  
a current\_user.  
well, I can only add ONE picture. Adding one more results in this error:

Mysql::Error: #42S22Unknown column ‘id’ in ‘where clause’: UPDATE  
portfolios SET `thumbnail` = ‘thumb’, `content_type` = ‘image/jpeg’,  
`user_id` = NULL, `height` = 81, `filename` = ‘godjesus\_thumb.jpg’,  
`width` = 100, `parent_id` = 0, `size` = ‘77847’ WHERE `id` = NULL

Now, why does it do this to me? It’s as if it doesn’t create a new  
direcotry called ‘0001’ and instead uses ‘0000’ where the picture is  
placed. If I delete the complete directory and delete the rows from my  
table I can add a new picture and it creates the ‘0000’ directory. Any  
suggestions, etc for solving this problem?

---

<div class="post-metadata">

**Author:** ![kaizerkaizer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/45deac/32.png) [@kaizerkaizer](https://www.ruby-forum.com/u/kaizerkaizer)\
**Post date:** [February 6, 2008, 5:36pm UTC](https://www.ruby-forum.com/t/attachment-fu-many-pictures-to-one-user/128306/2 "2008-02-06T17:36:43Z")

</div>

On 06 Feb 2008, at 16:52, Dag S. wrote:

> Now, why does it do this to me? It’s as if it doesn’t create a new  
> direcotry called ‘0001’ and instead uses ‘0000’ where the picture is  
> placed. If I delete the complete directory and delete the rows from my  
> table I can add a new picture and it creates the ‘0000’ directory. Any  
> suggestions, etc for solving this problem?

Looks like you’ve set :id =\> false in your portfolios table  
migration, while it should be there.

I’m using one-to-many relationships with an attachment\_fu model in a  
lot of our apps without a single problem. Something is wrong with  
your database structure.

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![kaizerkaizer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/45deac/32.png) [@kaizerkaizer](https://www.ruby-forum.com/u/kaizerkaizer)\
**Post date:** [February 7, 2008, 12:39am UTC](https://www.ruby-forum.com/t/attachment-fu-many-pictures-to-one-user/128306/3 "2008-02-07T00:39:09Z")

</div>

Peter De Berdt wrote:

> On 06 Feb 2008, at 16:52, Dag S. wrote:
> 
> > Now, why does it do this to me? It’s as if it doesn’t create a new  
> > direcotry called ‘0001’ and instead uses ‘0000’ where the picture is  
> > placed. If I delete the complete directory and delete the rows from my  
> > table I can add a new picture and it creates the ‘0000’ directory. Any  
> > suggestions, etc for solving this problem?
> 
> Looks like you’ve set :id =\> false in your portfolios table  
> migration, while it should be there.
> 
> I’m using one-to-many relationships with an attachment\_fu model in a  
> lot of our apps without a single problem. Something is wrong with  
> your database structure.
> 
> Best regards
> 
> Peter De Berdt

Hi,  
I guess I’ll have to do a re-do of it then. My problem started because I  
couldn’t migrate my database-table so I did it manually, and somehow I  
must have done something wrong there. The :id you’re talking about is  
not the parent\_id I’m guessing? Using SQL-fron there allways was a  
pre-defined :id, but in SQLyog there is none visable.

I’ll try it again, and hopefully re-doing it will solve it. Thanks
