attachment_fu, many pictures to one user

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?

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

Peter De Berdt 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