SORU
20 EKİM 2011, PERŞEMBE


Eğer ActiveRecord Nesne Yeni olup olmadığını belirlemek Ya da Oluşturulan

Nasıl onun yeni oluşturulan ya da olup olmadığını belirlemek için ActiveRecord nesneyi inceleyin miyim?

CEVAP
10 EYLÜL 2013, Salı


ActiveRecord nesne yaşam döngüsü:

1.yeni kayıt

item = Item.new
item.new_record? #=> true

2.devam etti

item.save
item.persisted? #=> true

3.değişti

item.name = "other"
item.changed? #=> true

4.yok

item.destroy
item.destroyed? #=> true

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • emimusic

    emimusic

    10 Mart 2006
  • Jack Vale Films

    Jack Vale Fi

    8 ŞUBAT 2007
  • justintimberlakeVEVO

    justintimber

    2 EYLÜL 2009