Thread: PaperClip: Attach files through script/console
-
LinkBack
-
Thread Tools
-
Search Thread
-
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/.
-
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/.
-
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
-
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,
__