The file_column plugin is great, but I''ve run into a case where I''d like to turn it off for an instance. My app has a ''demo'' mode, which needs to create a few rows of data on demand -- one column in which is defined by file_column. I cannot simply say: @picture = Picture.new @picture.filename = "/tmp/filename.jpg" @picture.save file_column will, of course, complain. But this is exactly what I''d like to do. Currently, I have to go out of my way to make file_column happy by creating a StringIO object that reads in the path of the file. While this works, it''s much slower than simply being able to save the filename directly. So is this possible? Maybe those with greater Ruby knowledge than I know of a way to remove any refernce to file_column one moment, and in the next, turn it back on. Thanks. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Is there any chance you could reuse a "Picture" that already exists? On 10/2/06, Adam Roth <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > The file_column plugin is great, but I''ve run into a case where I''d like > to turn it off for an instance. My app has a ''demo'' mode, which needs to > create a few rows of data on demand -- one column in which is defined by > file_column. I cannot simply say: > > @picture = Picture.new > @picture.filename = "/tmp/filename.jpg" > @picture.save > > file_column will, of course, complain. But this is exactly what I''d like > to do. > > Currently, I have to go out of my way to make file_column happy by > creating a StringIO object that reads in the path of the file. While > this works, it''s much slower than simply being able to save the filename > directly. > > So is this possible? Maybe those with greater Ruby knowledge than I know > of a way to remove any refernce to file_column one moment, and in the > next, turn it back on. > > Thanks. > > > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Carl Fyffe wrote:> Is there any chance you could reuse a "Picture" that already exists?Not in this case. Each demo user needs their own data (it''s not a problem that they''re pointing to the same image on the filesystem, however). -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---