From 11e4709fde69c766ebb18c3277602837955f7317 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 4 Apr 2012 02:49:58 +0300 Subject: [PATCH] fix compatibility with old events --- app/controllers/projects_controller.rb | 2 +- app/models/gitlab_serialize.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 459beec9a73..c832250a080 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -13,7 +13,7 @@ class ProjectsController < ApplicationController def index @projects = current_user.projects @projects = @projects.select(&:last_activity_date).sort_by(&:last_activity_date).reverse - @events = Event.where(:project_id => @projects.map(&:id)).recent.limit(40) + @events = Event.where(:project_id => @projects.map(&:id)).recent.limit(20) end def new diff --git a/app/models/gitlab_serialize.rb b/app/models/gitlab_serialize.rb index d5fda2a7a66..efd63ccede6 100644 --- a/app/models/gitlab_serialize.rb +++ b/app/models/gitlab_serialize.rb @@ -1,6 +1,12 @@ class GitlabSerialize # Called to deserialize data to ruby object. def load(data) + hash = parse_data(data) + hash = HashWithIndifferentAccess.new(hash) if hash + hash + end + + def parse_data(data) JSON.load(data) rescue JSON::ParserError begin