I’ve been playing with Rails Metal for quite some time now. Under certain circumstances, one Metal would catch something I intended for another metal deeper in the middleware stack. Reordering became the order of the day. The only problem was that the Rails Guide was in the works and I didn’t want to hack my metal files to put them in alphabetical order to match the order I wanted them in.
So, without further ado, here is how you reorder your Rails Metal middleware stack:
Open you environment.rb file:
vi config/environment.rb
Then add this line inside the initialization block:
1 | config.metals = ["FirstMetal", "ThirdMetal", "SecondMetal", "FinalMetal"] |
The strings in the array are the names of the metal files in camel case.







2 Comments »
m.farhan
May 20, 2009
hi,
i m new in ROR, n i found this site as a helping hand for the bigners like me…..
Rails Metal: A Quick Overview
June 13, 2009
[...] If you need to change the order your Rails Metal middleware stack, check out Get Your Rails Metal in Order. [...]
Leave a comment