Walter Lee, I am trying to pass a value (stream_type) that was in submitted in my form to :styles using proc.
Radhames, even if I do all this in the model, without a processor, I am still not able to get the value of stream_type, that was passed when the form tried to submit. So Philip, this means I would need to reprocess the file and delete the original? This means I will be processing the file twice? Isn't this a waste of resources if I only want one processed file that is adherent to the stream_type? On Oct 12, 12:07 am, Philip Hallstrom <[email protected]> wrote: > has_attached_file gets read when the class file is first read. It then sets > up the various paperclip methods that do there stuff. When it does that, > 'instance' is a new/blank record. > > What you have below will work (if memory serves me right) if you save the > record, reload it, and then reprocess it. > > Something along those lines... it's been awhile since I ran into this. > > -philip > > On Oct 10, 2010, at 1:22 PM, Christian Fazzini wrote: > > > anyone?? Been on this for days without a solution.... thinking that I > > may have to switch to another gem just to get this feature to work... > > > On Oct 7, 3:16 pm, Christian Fazzini <[email protected]> > > wrote: > >> I have a stream_type field on my form. When the form submits, > >> instance.stream_type is blank. To verify this, in my custom processor > >> (class ProcessAudio < Processor), I do puts options[:geometry]. > > >> has_attached_file :media, > >> :styles => { :original => Proc.new { |instance| > >> instance.stream_type } }, > >> :url => '/assets/artists/:artist_id/ > >> songs/:id/:style.:extension', > >> :path => ':rails_root/public/assets/ > >> artists/:artist_id/songs/:id/:style.:extension', > >> :processors => [:process_audio] > > >> If I provide a fixed string. For example: > > >> has_attached_file :media, > >> :styles => { :original => '30' }, > >> :url => '/assets/artists/:artist_id/ > >> songs/:id/:style.:extension', > >> :path => ':rails_root/public/assets/ > >> artists/:artist_id/songs/:id/:style.:extension', > >> :processors => [:process_audio] > > >> puts options[:geometry] = 30. Why does is it NOT work with proc? > > >> What is wrong? > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Talk" 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 > > athttp://groups.google.com/group/rubyonrails-talk?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en.

