[Nitro] Help with callbacks

Humber Aquino humberaquino at gmail.com
Thu Dec 22 14:41:22 EST 2005


Hi everyone! I'm having a problem defining callbacks.. i don't know if
this is a newbie question or something like that but i didn't found a
solution..

I want to define some callbacks to do some custom validations among
other things..
i started with the og callback example but it doesn't work.

require 'og'

class Post
    property :name, String

    def initialize(name)
      @name = name
    end

    def og_post_insert(conn)
        puts 'Hey, a new post was just posted!'
    end

    def og_post_insert
        puts 'Hey, a new post was just posted!'
    end
  end

 p = Post.create('Hello')
#No output

 p2 = Post.new('Bye')
 p2.save
#No output

Mi nitro version is 0.26

I tried the update callback too and nothing happened.. I also put
raise some exceptions to see if the callback is actually called.
Do i have to include some mixin? Or do something else?

Thanks for your time and help

Humber




More information about the Nitro-general mailing list