HI All,

I am using the carrier wave gem for file uploading, and I am not able to
delete the original file after uploading. I tried the below code but it
didn't work, any help would be really appreciated.

*
after :store, :unlink_original

def unlink_original(file)
File.delete(store_dir+'/'+@original_file) #path of the original file
end*

regards,
Loganathan
Mob: +91 7760780741 | +91 9944414388
Skype: loganathan.sellappa
ViewMe <http://vizualize.me/loganathan>

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Rubyonrailsx at Oct 17, 2012 at 8:59 am
    How about File.unlink instead of File.delete


    --
    rubyonrailsx
    Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


    On Monday, October 8, 2012 at 4:42 PM, Loganathan Sellapa wrote:

    >

    --
    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@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Colin Law at Oct 17, 2012 at 9:35 am

    On 8 October 2012 09:42, Loganathan Sellapa wrote:
    HI All,

    I am using the carrier wave gem for file uploading, and I am not able to
    delete the original file after uploading. I tried the below code but it
    didn't work, any help would be really appreciated.


    after :store, :unlink_original

    def unlink_original(file)
    File.delete(store_dir+'/'+@original_file) #path of the original file
    end
    Have you confirmed that unlink_original is being called and that the
    correct file name is being built and passed to delete? If you have
    not already done so then I suggest logging a message showing the value
    os
    store_dir+'/'+@original_file and makes sure that it appears ok.
    Alternatively break in with the debugger to make sure it is ok.

    Colin
    regards,
    Loganathan
    Mob: +91 7760780741 | +91 9944414388
    Skype: loganathan.sellappa
    ViewMe


    --
    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@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedOct 8, '12 at 8:43a
activeOct 17, '12 at 9:35a
posts3
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2022 Grokbase