grosser/gettext_i18n_rails — pull request #40 by cameel (2011-12-02 12:52:58+00:00)
Title: Make model_attributes_finder.rb work with (most) namespaced models

`rake gettext:store_model_attributes` does not find namespaced models. The table name -> model conversion is actually ambiguous if we allow namespaces, but with some reasonable assumptions it can be done most of the time. This patch makes it work with models nested at most one level deep.

This is a simple fix. A better one would be to stop trying to convert table names to model names (which is not possible to do reliably in a general case) and enumerate descendants of ActiveRecord::Base instead (using ActiveRecord::Base.descendants()). It, however, requires forcing Rails to preload all model classes at startup. This method would also include models defined by gems which may be desired in some cases and not in the others - there should be an option to filter them out.