好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

Thread: PaperClip: Attach files through script/con

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 Mode

08-16-2010 02:08 PM #1

John O'gara

Guest

PaperClip: Attach files through script/console
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 #2

John O'gara

Guest

Re: PaperClip: Attach files through script/console
Worked 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/console
On 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/console
Thanks 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的详细内容...

  阅读:40次