[katello-devel] Lazy attribute redefinition

Lukas Zapletal lzap at redhat.com
Fri May 27 12:44:28 UTC 2011


Hey Dmitri,

I have redefined one argument error you are throwing:

   http://pastie.org/private/wp8lusn1zbusflypvajeg

to only warning message. Is that a problem for you?

The problem is I have a code that do this:

   # explicitly load all available model classes
   Dir.foreach("#{Rails.root}/app/models") {
     |f| require f if f =~ /.*\.[rR][bB]/
   }

For the AR RBAC I need to translate table names to model class names and 
I need to load all model classes. In production mode I do this only once.

It was throwing me exception

   Remote attribute "productContent" already defined

so I turned this into a warning message.

I believe the Ruby "require" statement loads the class only once. I dont 
know why it is trying to load product.rb when the file has been already 
loaded. Maybe this is Rails 3 behavior for the development mode.

If this turns out to be a problem we can always create such a hash "by 
hand".

LZ

-- 
Later,

  Lukas Zapletal | E32E400A
  RHN Satellite Engineering
  Red Hat Czech s.r.o. Brno




More information about the katello-devel mailing list