If I were you, I'd focus on finding a way to run your bootstrapping migrations either outside the context of your rails app. Failing that, You can wrap your whole controller definition in a begin/rescue block and define a stubbed out class when the exception is raised...
Not great solutions, but hopefully enough to get you unblocked until there's a better one. chris On Mon, Jul 13, 2009 at 12:12 AM, David Parry <[email protected]>wrote: > > We are having a problem with > > config.cache_classes = true > > and ActiveScaffold. > > We are using acts_as_audited to produce audit logs of changes in our > models. The audits log itself is (of course) being rendered with > ActiveScaffold. > > The problem we are seeing is that in the test (and therefore > production) environments, because cache_classes is on (for speed), > somehow a cyclic dependency has crept in such that the audits > controller is needed to be loaded at Rails Initilization, which is > needed to run rake db:migrate . > > The failure occurs because the audits table hasn't been created yet > because we're doing a db:migrate and nothing has been created yet. > > The reason the audits table is being accessed is because active > scaffold is being called in the usual block at the class level... e.g: > > class AuditsController < ApplicationController > active_scaffold :audit > ... > end > > > If we turn config.cache_classes off (as in development) then this > works fine. Turn it on, and it tries to access the audits table. > > Is there a way to call "active_scaffold :audit" NOT at the class > initialization level? I tried adding a method that calls > "active_scaffold :audit" as a before_filter but it seems to be > unavailable to my controller. Which is odd, because if I step through > the code during a rake db:migrate RAILS_ENV=test, then the method > "active_scaffold" is clearly available to be called. When I try to > call it later (after the class has been loaded) then it's no longer > there. > > > Is there another way to initialize active_scaffold for a controller? > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/activescaffold?hl=en -~----------~----~----~----~------~----~------~--~---
