Thanks, but I need something that works in 1.1.5 and not edge.
Although, looking at the code for Dispatcher.to_prepare did give me an
idea that turned out to work for me.

Thanks again,
Andrew

On 8/9/06, Rick Olson <[EMAIL PROTECTED]> wrote:
On 8/9/06, Andrew Kaspick <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I'm having a problem with some dynamic classes that I'm trying to use
> in my development environment.
>
> My app is creating some dynamic classes that descend from
> ActiveRecord::Base.  Now this part works fine, except that they only
> exist for the life of one request in my development environment and
> then they no longer exist.  I'm calling a method from my
> environment.rb to to do the initial class creation.
>
> My current approach to recreating these classes is to use
> const_missing if the classes aren't found, but I'm not having very
> much success with this approach.  I'm not sure this is even a safe
> approach to solving my problem, so I was wondering if somebody (with
> more in depth knowledge of how classes are reloaded) can give me a few
> pointers on things I should be looking for, trying.
>
> I can post some code if needed, but maybe there are some general
> guidelines I should be following to begin with.
>
> Thanks,
> Andrew

Try the new dispatcher preparation callbacks:

Dispatcher.to_prepare :dynamic_models do

end

They are run during the 'preparation' phase, which is after everything
has been loaded.  They'll run once during production, and before each
request in development mode.

--
Rick Olson
http://techno-weenie.net
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to