Kaydet ataç ile URL den resim | Netgez.com
SORU
29 EKİM 2010, Cuma


Kaydet ataç ile URL den resim

Lütfen bana Öner Ataç ile bir URL bir görüntü kaydetmek için bir yol.

CEVAP
29 EKİM 2010, Cuma


İşte basit bir yol

require "open-uri"

class User < ActiveRecord::Base
  has_attached_file :picture

  def picture_from_url(url)
    self.picture = open(url)
  end
end

O zaman sadece :

user.picture_from_url "http://www.google.com/images/logos/ps_logo2.png"

Bunu PaylaÅŸ:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • ★ByScrapi★ Designs

    ★ByScrapiâ

    27 AÄžUSTOS 2013
  • ArkticPlanet

    ArkticPlanet

    9 ÅžUBAT 2010
  • TantalizingTrance

    TantalizingT

    15 ÅžUBAT 2009