On Sep 21, 2011, at 1:48 PM, Banjoey wrote:

> I have a rails site where I allow a user to upload an mp3 file to
> create a podcast. Once uploaded (using paperclip) I use mp3info to
> read the metadata and then populate the model information if it has
> been specified. I decided to redo this in hobo.
> 
> I think I am having trouble with the order of callbacks or something.
> The model code I have is pasted below. It is currently strewn with
> various "attempts" of me trying to debug, etc. with puts, so please
> don't laugh too much. I also copied/pasted it so it's entirely
> possible I have a typo, but I don't think so. My problem is that the
> after_audio_post_process callback gets called, but for some reason it
> doesn't appear to be "saving" the information to the db. Is this
> called after the model is saved? If so, do I need to call something in
> assign_episode_info to save my model after I have updated the title,
> description, etc.? I tried to put a self.save in at the bottom and
> that didn't work (I got an error on that), so I'm assuming I have to
> do something else.

This looks like it should work - the callback is called when the file is 
assigned, so that's well before save.

One question - do you have fields for 'title', 'description', etc on the form 
where you're uploading the file? That might produce the described behavior, as 
they would get set by the callback and then stomped by the data coming from the 
form...

--Matt Jones

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to