diff --git a/app/models/site_feed_annc.rb b/app/models/site_feed_annc.rb index 6a3f6ab..d149db7 100644 --- a/app/models/site_feed_annc.rb +++ b/app/models/site_feed_annc.rb @@ -29,7 +29,7 @@ class SiteFeedAnnc def cache_annc(force_refresh=false,locales=nil,trans=nil) feed = SiteFeed.find(self.feed_id) anns = feed.get_annc(force_refresh) - cat = self.category_title + cat = self[:category_title] if locales.nil? locales = Site.first.in_use_locales rescue I18n.available_locales end @@ -162,6 +162,7 @@ class SiteFeedAnnc end def self.get_feed_cache(channel_key,merge_with_category=nil,site_source=nil,locale=I18n.locale.to_s,is_widget=false,max_len=nil) + locale = I18n.locale.to_s max_len = ((max_len.to_i < 0 rescue true) ? 0 : max_len.to_i) if max_len > 0 match_cond = {"channel_key"=>channel_key} @@ -187,6 +188,7 @@ class SiteFeedAnnc end self.collection.aggregate(pipeline).collect do |data| tmp = data['data'] + tmp['category'] = tmp['category'][locale] if tmp["link_to_show"].nil? if !is_widget tmp["link_to_show"] = UseSourceUrl && tmp["show_url"] ? (tmp["source_url"] + tmp["show_url"]) : OrbitHelper.url_to_show(tmp["params"]) rescue '' @@ -209,6 +211,7 @@ class SiteFeedAnnc Array(self[:all_contents_for_feed][locale.to_s]).collect do |v| tmp = v next if tmp["is_hidden"] || (!tmp["postdate"].nil? && tmp["postdate"]