Not talking about having it recycle (I assume all Camping apps have a small carbon footprint). I''m talking about letting the create method know this is the dev/test/prod environment and have it load the appropriate database connection info etc. Any thoughts on this? Having create take an env arguments seems the simplest to me. -- Dave
Why don''t add this? def App.create(env = :development) end And in production, you can call App.create(:production) yourself. // Magnus Holm On Tue, Aug 24, 2010 at 15:36, David Susco <dsusco at gmail.com> wrote:> Not talking about having it recycle (I assume all Camping apps have a > small carbon footprint). > > I''m talking about letting the create method know this is the > dev/test/prod environment and have it load the appropriate database > connection info etc. > > Any thoughts on this? Having create take an env arguments seems the > simplest to me. > > -- > Dave > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >
Ya, that''s what I''m doing. Just wondering if there was another way to go about it. I modified your camping-test/base file to call ''create :test'' and specified a test db adapter in my config file to get around the problem I e-mailed you about. Dave On Tue, Aug 24, 2010 at 9:44 AM, Magnus Holm <judofyr at gmail.com> wrote:> Why don''t add this? > > ?def App.create(env = :development) > ?end > > And in production, you can call App.create(:production) yourself. > > // Magnus Holm > > > > On Tue, Aug 24, 2010 at 15:36, David Susco <dsusco at gmail.com> wrote: >> Not talking about having it recycle (I assume all Camping apps have a >> small carbon footprint). >> >> I''m talking about letting the create method know this is the >> dev/test/prod environment and have it load the appropriate database >> connection info etc. >> >> Any thoughts on this? Having create take an env arguments seems the >> simplest to me. >> >> -- >> Dave >> _______________________________________________ >> Camping-list mailing list >> Camping-list at rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list >> > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-- Dave
What about this: def App.create(env = (ENV[''CAMPING_ENV''] || :development)) end Then you can simply set ENV[''CAMPING_ENV''] = "test" before loading any tests. // Magnus Holm On Tue, Aug 24, 2010 at 16:21, David Susco <dsusco at gmail.com> wrote:> Ya, that''s what I''m doing. Just wondering if there was another way to > go about it. I modified your camping-test/base file to call ''create > :test'' and specified a test db adapter in my config file to get around > the problem I e-mailed you about. > > Dave > > On Tue, Aug 24, 2010 at 9:44 AM, Magnus Holm <judofyr at gmail.com> wrote: >> Why don''t add this? >> >> ?def App.create(env = :development) >> ?end >> >> And in production, you can call App.create(:production) yourself. >> >> // Magnus Holm >> >> >> >> On Tue, Aug 24, 2010 at 15:36, David Susco <dsusco at gmail.com> wrote: >>> Not talking about having it recycle (I assume all Camping apps have a >>> small carbon footprint). >>> >>> I''m talking about letting the create method know this is the >>> dev/test/prod environment and have it load the appropriate database >>> connection info etc. >>> >>> Any thoughts on this? Having create take an env arguments seems the >>> simplest to me. >>> >>> -- >>> Dave >>> _______________________________________________ >>> Camping-list mailing list >>> Camping-list at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/camping-list >>> >> _______________________________________________ >> Camping-list mailing list >> Camping-list at rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list >> > > > > -- > Dave > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >
The create method is being called before anything I do in my test file though. Dave On Tue, Aug 24, 2010 at 11:27 AM, Magnus Holm <judofyr at gmail.com> wrote:> What about this: > > ?def App.create(env = (ENV[''CAMPING_ENV''] || :development)) > ?end > > Then you can simply set ENV[''CAMPING_ENV''] = "test" before loading any tests. > > // Magnus Holm > > > > On Tue, Aug 24, 2010 at 16:21, David Susco <dsusco at gmail.com> wrote: >> Ya, that''s what I''m doing. Just wondering if there was another way to >> go about it. I modified your camping-test/base file to call ''create >> :test'' and specified a test db adapter in my config file to get around >> the problem I e-mailed you about. >> >> Dave >> >> On Tue, Aug 24, 2010 at 9:44 AM, Magnus Holm <judofyr at gmail.com> wrote: >>> Why don''t add this? >>> >>> ?def App.create(env = :development) >>> ?end >>> >>> And in production, you can call App.create(:production) yourself. >>> >>> // Magnus Holm >>> >>> >>> >>> On Tue, Aug 24, 2010 at 15:36, David Susco <dsusco at gmail.com> wrote: >>>> Not talking about having it recycle (I assume all Camping apps have a >>>> small carbon footprint). >>>> >>>> I''m talking about letting the create method know this is the >>>> dev/test/prod environment and have it load the appropriate database >>>> connection info etc. >>>> >>>> Any thoughts on this? Having create take an env arguments seems the >>>> simplest to me. >>>> >>>> -- >>>> Dave >>>> _______________________________________________ >>>> Camping-list mailing list >>>> Camping-list at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/camping-list >>>> >>> _______________________________________________ >>> Camping-list mailing list >>> Camping-list at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/camping-list >>> >> >> >> >> -- >> Dave >> _______________________________________________ >> Camping-list mailing list >> Camping-list at rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list >> > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list-- Dave