Fearless, here is the code pattern I chose. it adds a bunch of custom code to
config/environments/development.rb
in order to not have to pollute your class heirarchies with
'development only hacks' code ..
I put this below the configure do block in development.rb:
i personally prefer this because it is just generating special
behavior for the development environment instead of altering behavior
on all environments.
-= Max
if Rails.env.development?
# Bootstrap classes being referenced as we use meta-programming that
# does not get called in development because class caching
# is off. Merely accessing the classes by name triggers the
# callbacks that otherwise get called immediately with class
# caching on in non-development environments.
def bootstrap_x_callbacks
X1.nil?
X2.nil?
X3.nil?
X4.nil?
X5.nil?
X6.nil?
end
# Run once on startup after Rails environment is all warmed up and
# ready to rock.
MyApp::Application.configure do
config.after_initialize do
bootstrap_x_callbacks
end
end
# Schedule it to be called after every reload!
ActionDispatch::Callbacks.after do
bootstrap_x_callbacks
end
end
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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/rubyonrails-talk?hl=en.