浙江省高等学校教师教育理论培训

微信搜索“毛凌志岗前心得”小程序

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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  阅读(275)  评论(0编辑  收藏  举报