Module: Ixtlan::Controllers::WordBundlesController
- Defined in:
- lib/ixtlan/controllers/word_bundles_controller.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/ixtlan/controllers/word_bundles_controller.rb', line 5 def self.included(base) # no guard since everyone needs to load the bundles base.skip_before_filter :guard base.cache_headers :protected end |
Instance Method Details
#index ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ixtlan/controllers/word_bundles_controller.rb', line 18 def index locale = params[:code] # TODO load in following order and allow to replace findings in the # intermediate result set # * DEFAULT not_approved # * DEFAULT latest_approved # * locale-parent latest_approved # * locale latest_approved l = LOCALE.first(:code => locale) || LOCALE.get!(locale) word_bundle = {} Ixtlan::Models::Word.not_approved(:locale => LOCALE.default).each do |word| word_bundle[word.code] = word end Ixtlan::Models::Word.approved(:locale => LOCALE.default).each do |word| word_bundle[word.code] = word end render :xml => "<word_bundle><locale>#{locale}</locale><words>" + word_bundle.values.collect { |w| w.to_xml }.join + "</words></word_bundle>" end |