On Lunes, 13 de Julio de 2009 09:12:04 David Parry escribió: > 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 .
Are you using rails 2.2? There was a problem with some plugins and rake db:migrate with cache_classes enabled in rails 2.2, it was fixed in 2.3 You have some workarounds in issue 638: http://code.google.com/p/activescaffold/issues/detail?id=638&can=1&q=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? > > > > > -- Sergio Cambra .:: entreCables S.L. ::. Mariana Pineda 23, 50.018 Zaragoza T) 902 021 404 F) 976 52 98 07 E) [email protected] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
