Topic: Creating photo albums with attachment_fu - Help please?

Hello everyone,

  I finally got attachment_fu working nicely with MiniMagick.  My only problem now is that I am trying to assign photos to albums, but for some reason it does not work.

Album Model

  has_many :photos

Photo Model
  belongs_to :album

But unfortunately when I try and save the album_id along with @photo by even trying...

...
  @photo.album_id = params[:photo][:album_id]
...

I get a SQL error saying album_id can not be NULL.

Does anyone have any clues as to where I can start trying to get this little piece of functionality to work?

Thanks in advance,
Adam

Re: Creating photo albums with attachment_fu - Help please?

Any suggestions at all?

Re: Creating photo albums with attachment_fu - Help please?

Try to do @photo.album_id = 1 or @photo.album = Album.find(:first).id and check if it works.

Are you sure that params[:photo][:album_id] actually holds a valid number? You could try to see exactly the contents of params hash by displaying or writing to log file params.inspect