Christian Fazzini
2010-Oct-02 19:36 UTC
How to make has_attached_file dynamic depending on form values
My form submits with a column called stream_type, which can either be "full", "30secs" or "90secs". How can i set it so that it sets has_attached_file according to the form value stream_type? -------------- Model class looks like this: has_attached_file :media, :styles => { :original => <need_to_set_dynamic_content_here> }, :url => ''/assets/artists/:artist_id/ songs/:id/:style.:extension'', :path => '':rails_root/public/assets/ artists/:artist_id/songs/:id/:style.:extension'', :processors => [:process_audio] -------------- So for example, if my form submits with stream_type = 90secs, then has_attached_file will look like: 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] -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Christian Fazzini
2010-Oct-02 19:37 UTC
Re: How to make has_attached_file dynamic depending on form values
I am using Paperclip by the way On Oct 3, 3:36 am, Christian Fazzini <christian.fazz...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> My form submits with a column called stream_type, which can either be > "full", "30secs" or "90secs". > > How can i set it so that it sets has_attached_file according to the > form value stream_type? > > -------------- > > Model class looks like this: > > has_attached_file :media, > :styles => { :original => > <need_to_set_dynamic_content_here> }, > :url => ''/assets/artists/:artist_id/ > songs/:id/:style.:extension'', > :path => '':rails_root/public/assets/ > artists/:artist_id/songs/:id/:style.:extension'', > :processors => [:process_audio] > > -------------- > > So for example, if my form submits with stream_type = 90secs, then > has_attached_file will look like: > > 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]-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Christian Fazzini
2010-Oct-06 17:43 UTC
Re: How to make has_attached_file dynamic depending on form values
anyone? On Oct 3, 3:37 am, Christian Fazzini <christian.fazz...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am using Paperclip by the way > > On Oct 3, 3:36 am, Christian Fazzini <christian.fazz...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > My form submits with a column called stream_type, which can either be > > "full", "30secs" or "90secs". > > > How can i set it so that it sets has_attached_file according to the > > form value stream_type? > > > -------------- > > > Model class looks like this: > > > has_attached_file :media, > > :styles => { :original => > > <need_to_set_dynamic_content_here> }, > > :url => ''/assets/artists/:artist_id/ > > songs/:id/:style.:extension'', > > :path => '':rails_root/public/assets/ > > artists/:artist_id/songs/:id/:style.:extension'', > > :processors => [:process_audio] > > > -------------- > > > So for example, if my form submits with stream_type = 90secs, then > > has_attached_file will look like: > > > 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] > >-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.