Sha256: 09f1c5699a8542a22b2e3d644cf148ba810c444cb765789ca0b5d0d89525a897

Contents?: true

Size: 865 Bytes

Versions: 4

Compression:

Stored size: 865 Bytes

Contents

module Ixtlan
  module Controllers
    module WordBundlesController

      def show
        locale = params[:id]
        # 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.get!(locale)
        wordMap = {}
        Ixtlan::Models::Word.not_approved(:locale => Locale.default).each do |word|
          wordMap[word.code] = word
        end
        Ixtlan::Models::Word.approved(:locale => Locale.default).each do |word|
          wordMap[word.code] = word
        end
        
        render :xml => "<word_bundle><locale>#{locale}</locale><words>" + wordMap.values.collect { |w| w.to_xml }.join + "</words></word_bundle>"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ixtlan-0.2.4 lib/ixtlan/controllers/word_bundles_controller.rb
ixtlan-0.2.3 lib/ixtlan/controllers/word_bundles_controller.rb
ixtlan-0.2.2 lib/ixtlan/controllers/word_bundles_controller.rb
ixtlan-0.2.1 lib/ixtlan/controllers/word_bundles_controller.rb