[Nitro] before-hook doesn't work anymore

Michael Fellinger m.fellinger at gmail.com
Sat Nov 19 17:37:17 EST 2005


Hey brian,

It's a quite simple case:

class OgFile
  is Timestamped
  property :filename, String
  property :path,     String
  property :file,     String
  property :filesize, Integer
  before %{ FileUtils.rm(@file) if $options[:rm_delete] }, :on => [:og_delete]

  # the *args is mainly for later additional objects. (see OgImage below)

  def fill(*args)
    file = args[0]
    @filename = file.original_filename
    @filesize = file.size
    @path     = File.join($options[:uploads_public], @filename)
    @file     = File.join($options[:uploads_relative], @filename)

    puts "copy #{file.path} to #{@file}" if $DBG
    FileUtils.cp(file.path, @file)
  end

  def to_s
    "<a href='/#{@path}'>#{@filename}</a>"
  end
end


Am Samstag 19 November 2005 19:05 schrieb Bryan Soto:
> Hi,
>
> Only way I can get a NoMethodError for before is if I call it before any
> properties are defined. I don't think that's your problem since you said
> you're upgrading.
>
> Could you share the model.rb file? Or at least a small portion that causes
> the same error?
>
> Re: super, you've pretty much got it. method_missing is called if a class
> or it's super-classes don't define a method. That's how we get George's fun
> find_by_such_and_such methods without having to define them. The super call
> in this case means "I don't know what to do with this message." and hands
> it off to the super class in case it does. And if it get's to Object,
> Object throws that nice little error message you got.
>
> The methods are actually defined (glue/lib/glue/aspects.rb). I don't think
> there is any method_missing magic for aspects.
>
> bryan
>
> On 11/19/05, Michael Fellinger <m.fellinger at gmail.com> wrote:
> > Hey list,
> >
> > I have one serious problem with switching to 0.25.0 here.
> > when i try to use this hook:
> >
> > before { puts "doesn't work" }, :on [:og_delete]
> >
> > i get following nice error at startup, and nitro shuts down.
> >
> > /usr/lib/ruby/gems/1.8/gems/og-0.25.0/lib/og/entity.rb:376:in
> > `method_missing': undefined method `before' for OgFile:Class
> > (NoMethodError)
> > from ./src/model.rb:30
> > from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in
> > `require'
> > from /var/www/current/nixel/public/../run.rb:11
> > from /var/www/current/nixel/public/fcgi.rb:6
> >
> >
> > well, having this error wouldn't be that bad, if it wasn't a very special
> > error - it points to method_missing (more correct - line 376) and what is
> > in
> > this line:
> >
> > super
> >
> > that's it. No idea what voodoo is going on here - my ruby-instinct says
> > me that this is an inherited class/module and takes the method_missing of
> > the previous class in this special case. (i guess when in this
> > method_missing no
> > rule is defined for 'before') and now it fails even in the previous
> > defined
> > (if there is one defined... maybe it's only a call to an error-method?)
> >
> > can somebody help me on this?
> >
> > thx in pre,
> > manveru
> >
> >
> > _______________________________________________
> > Nitro-general mailing list
> > Nitro-general at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/nitro-general
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20051119/d16fd23f/attachment.bin 


More information about the Nitro-general mailing list