[Nitro] Help with callbacks

Chris Farmiloe chris at motionpath.com
Thu Dec 22 14:50:05 EST 2005



use:

post :og_post_insert, :on => :og_insert

(whack that just after the property declaratoin... i think og_insert  
is a valid aspect method)

sorry im breif... just walking out of office. hope that
tips you in the right direction



Chris Farmiloe
Design & Development.


On 22 Dec 2005, at 19:41, Humber Aquino wrote:

> 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
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20051222/d492f9ad/attachment.html 


More information about the Nitro-general mailing list