diff --git a/app/controllers/concerns/commentable_actions.rb b/app/controllers/concerns/commentable_actions.rb index e46ba7da4..3c62facd5 100644 --- a/app/controllers/concerns/commentable_actions.rb +++ b/app/controllers/concerns/commentable_actions.rb @@ -73,7 +73,7 @@ module CommentableActions end def tag_cloud - resource_model.last_week.tag_counts.order("#{resource_name.pluralize}_count": :desc, name: :asc).limit(5) + TagCloud.new(resource_model).tags end def load_geozones diff --git a/app/models/tag_cloud.rb b/app/models/tag_cloud.rb new file mode 100644 index 000000000..e4598971a --- /dev/null +++ b/app/models/tag_cloud.rb @@ -0,0 +1,13 @@ +class TagCloud + + attr_accessor :resource_model + + def initialize(resource_model) + @resource_model = resource_model + end + + def tags + resource_model.last_week.tag_counts.order("#{resource_model.to_s.downcase.pluralize}_count": :desc, name: :asc).limit(5) + end + +end \ No newline at end of file