Loading ...
Sorry, an error occurred while loading the content.

Bls: [id-ruby] teknik cara membuat callback ?

Expand Messages
  • Fery Beckham
    klo has_many, belongs_to itu relationship thd table nya, kl before_save, and after_save itu callback nya (method apa aj yg mw di panggil stlh menjalankan
    Message 1 of 6 , Feb 10 7:22 PM
    • 0 Attachment
      klo has_many, belongs_to itu relationship thd table nya, kl before_save, and
      after_save itu callback nya (method apa aj yg mw di panggil stlh menjalankan
      action tsb)...CMIIW



      ________________________________
      Dari: Aditya Agustyana <aditya.jamop@...>
      Kepada: id-ruby <id-ruby@yahoogroups.com>
      Terkirim: Jum, 11 Februari, 2011 07:01:14
      Judul: [id-ruby] teknik cara membuat callback ?


      Hello teman2 Rubyists

      mungkin term callback kurang tepat, tapi sy sendiri gak tau mesti menamainya
      apa :-(

      di rails terutama active record, sering sekali muncul hal yg seperti ini

      class Book
      has_many :readers
      belongs_to :author
      before_save :assign_something
      after_save :burn_the_book # are you sure ? :-p

      def weird_method
      #weird implementation
      end
      end

      nah yg sy ingin tanyakan

      1. has_many, belongs_to, before_save dan after_save itu namanya apa ya ?
      class method ?, singleton method ? atau apa ya
      2. kalo kita mau bikin sendiri sesuatu yg seperti itu teknik codingnya gmn
      ya ?

      regards

      Aditya

      --
      profile : http://about.me/aditya.agustyana
      ym / twitter : kirconboy
      skype : adit_skype

      Be Nice. Treat others with the same respect you'd want them to treat you.
      We're all here to learn together. Be tolerant of others who may not know
      everything you know. BRING YOUR SENSE OF HUMOR (stackoverflow.com)

      [Non-text portions of this message have been removed]






      [Non-text portions of this message have been removed]
    • Achmad Gozali
      maksudnya mau bikin before_filter_custom_sendiri_di_model :method gitu ya Dit? bikin modul ActiveRecord di lib misalnya seperti ini :
      Message 2 of 6 , Feb 10 8:32 PM
      • 0 Attachment
        maksudnya mau bikin
        before_filter_custom_sendiri_di_model :method

        gitu ya Dit?

        bikin modul ActiveRecord di lib misalnya seperti ini :

        https://gist.github.com/4f5f5b884694a9d5038e

        baru dipanggil di model

        CMIIW :)

        -- Gozali
        http://twitter.com/gozali
      Your message has been successfully submitted and would be delivered to recipients shortly.