Andrew Premdas
2010-01-02 21:17:09 UTC
Hi all,
First of all apologies for this borderline off-topic post. I think it has
enough of a Cucumber element to be worth posting here
Looking for some comment on a general policy I'm trying to create for
dealing with various settings in our application. We have a number of things
like postage_rate, vat_rate, image_path etc. etc. which in our production
environment will be CONSTANTS. All of these things however need to be set to
a variety of values when running features and spec. What I am trying to do
is work out the best way to do this in a Rails app.
Currently my thinking is to make all these things CONSTANTS in a module in
an initializer, and then to freeze this module in production.rb. So a simple
version might be
module AppConstants
module Postage
RATE = 399
end
module Images
PATH = "#{RAILS_ROOT}/public/images"
end
end
and the last line of production.rb would be
AppConstants.freeze
Does this make sense? What do you do to address this problem?
I believe this approach will result in a lot of warnings being generated
when we run our features. Is there a way to turn the warnings of?
Thankyou for your help
Andrew
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.
First of all apologies for this borderline off-topic post. I think it has
enough of a Cucumber element to be worth posting here
Looking for some comment on a general policy I'm trying to create for
dealing with various settings in our application. We have a number of things
like postage_rate, vat_rate, image_path etc. etc. which in our production
environment will be CONSTANTS. All of these things however need to be set to
a variety of values when running features and spec. What I am trying to do
is work out the best way to do this in a Rails app.
Currently my thinking is to make all these things CONSTANTS in a module in
an initializer, and then to freeze this module in production.rb. So a simple
version might be
module AppConstants
module Postage
RATE = 399
end
module Images
PATH = "#{RAILS_ROOT}/public/images"
end
end
and the last line of production.rb would be
AppConstants.freeze
Does this make sense? What do you do to address this problem?
I believe this approach will result in a lot of warnings being generated
when we run our features. Is there a way to turn the warnings of?
Thankyou for your help
Andrew
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.