Thread: PaperClip: Attach files through script/console

Thread: PaperClip: Attach files through script/console

  1. 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 Reply With Quote


  2. 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/.

    Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTweet this Post!

    Reply With Quote Reply With Quote


  3. 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

    Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTweet this Post!

    Reply With Quote Reply With Quote


  4. 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,
    __
posted on 2011-01-13 21:02  lexus 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/lexus/archive/2011/01/13/1934908.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值