Stephan Wehner
2010-Mar-22 16:38 UTC
Rails Configuration: use Proc''s or method overrides?
I came across a ticket by Craig Webster at https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4247-customising-asset-paths#ticket-4247-5 and found it quite interesting. Quote: This patch allows you to set the way that asset paths are rewritten. My own use case was to accommodate a server setup where not all of the assets have the same mtime even if they''re the same file. If this is not set then it falls back to the default of using ENV[''RAILS_ASSET_ID''] or the file mtime. # config/environments/production.rb # Normally you''d calculate RELEASE_NUMBER at startup. RELEASE_NUMBER = 12345 config.action_controller.asset_path_template = proc { |asset_path| "/release-#{RELEASE_NUMBER}#{asset_path}" } End Quote. I feel it goes to the heart of Rails, namely, how should configuring an application be organized? In this case it seemed to me better to make use of Ruby method overrides. At the same time, it would be good to have some uniformity with respect to configuration. Meaning when developing a patch like this, it would be good to have a guide. What do you think? Stephan -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.