fix compatibility with old events

This commit is contained in:
Dmitriy Zaporozhets 2012-04-04 02:49:58 +03:00
parent a951e6f8ae
commit 11e4709fde
2 changed files with 7 additions and 1 deletions

View file

@ -13,7 +13,7 @@ class ProjectsController < ApplicationController
def index def index
@projects = current_user.projects @projects = current_user.projects
@projects = @projects.select(&:last_activity_date).sort_by(&:last_activity_date).reverse @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 end
def new def new

View file

@ -1,6 +1,12 @@
class GitlabSerialize class GitlabSerialize
# Called to deserialize data to ruby object. # Called to deserialize data to ruby object.
def load(data) def load(data)
hash = parse_data(data)
hash = HashWithIndifferentAccess.new(hash) if hash
hash
end
def parse_data(data)
JSON.load(data) JSON.load(data)
rescue JSON::ParserError rescue JSON::ParserError
begin begin