rails/rails — pull request #4608 by indrekj (2012-01-22 22:08:38+00:00)
Title: Raise exception when date.order includes invalid elements

## Short background story:
Our locales files were translated to Russian, but the translator didn't know that :locale.date.order is not translatable. So the locale file looked like this:

order:
- :день
- :месяц
- :год

In the view we had `f.date_select :starts_at` and this raised an exception:

undefined method `select_год' for #

I debugged it and found out, that this comes from the locale file.

## About pull request
I feel that :order values from locales should not be evaluated directly. Actual line that evaluates it: https://github.com/indrekj/rails/blob/translated_date_order/actionpack/lib/action_view/helpers/date_helper.rb#L961

My patch adds code to check if the order includes only :year, :month and :day. If it doesn't then it raises an exception.

I'm not sure if my approach is correct. I wasn't sure which type of exception should be raised. Maybe there shouldn't be anything raised. Even if my patch is bad, I still feel that there should be more informative message than undefined method `select_год` exception.