Thread: PaperClip: Attach files through script/console
Thread: PaperClip: Attach files through script/console LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread! Add Thread to del.icio.us Bookmark in Technorati Tweet this Thread! Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Search Thread
Advanced Search
Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode08-16-2010 02:08 PM #1
John O'gara
Guest
PaperClip: Attach files through script/consoleI'm wondering is it possible to attach a file through script/console?
__
Posted via http://www.ruby-forum.com/ .Reply With Quote
08-16-2010 02:08 PM #2
John O'gara
Guest
Re: PaperClip: Attach files through script/consoleWorked this out for myself in a round about way, I used rest_client and
made a post locally, if anyone knows of a "neater" way I'd like to know
John O'gara wrote:
> I'm wondering is it possible to attach a file through script/console?
__
Posted via http://www.ruby-forum.com/ .
Reply With Quote
08-16-2010 02:08 PM #3
Luis Lavena
Guest
Re: PaperClip: Attach files through script/consoleOn 21 ene, 19:53, John O'gara <john.og... (AT) gmail (DOT) com> wrote:
> I'm wondering is it possible to attach a file through script/console?
image = Image.new(:storage => File.open('/path/to/my/image.png', rb))
Where:
Image is your model
storage is your paperclip definition of has_attachment.
HTH,
__
Luis Lavena
Reply With Quote
08-16-2010 02:08 PM #4
John O'gara
Guest
Re: PaperClip: Attach files through script/consoleThanks Luis, thats much neater.
Luis Lavena wrote:
> image = Image.new(:storage => File.open('/path/to/my/image.png', rb))
>
> Where:
>
> Image is your model
> storage is your paperclip definition of has_attachment.
>
> HTH,
__查看更多关于Thread: PaperClip: Attach files through script/con的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did43367