Permalink
Browse files

Fix bug in project serialization

  • Loading branch information...
1 parent 148685f commit de72dc9ba93ecd17b3796990c0c09fc8b98096d1 @bwalex committed Apr 14, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 db.rb
View
7 db.rb
@@ -259,6 +259,7 @@ class Document < ActiveRecord::Base
class Project < ActiveRecord::Base
attr_accessor :new_owner
+ attr_accessor :current_user
belongs_to :owner, :class_name => "User",
:foreign_key => "owner_id"#,
@@ -332,8 +333,8 @@ def event_stats
filters = ["extres"]
if defined? @current_user and not @current_user.nil?
- s = @current_user.user_project_settings.where(:project_id => @project.id, :key => 'timeline:events')
- filters = filters | s[0].value.split(',')
+ s = @current_user.user_project_settings.where(:project_id => self[:id], :key => 'timeline:events')
+ filters = filters | s[0].value.split(',') unless s.empty?
end
return {
@@ -342,7 +343,7 @@ def event_stats
end
def as_json(options={})
- @current_user = options.user if defined? options.user
+ @current_user = options[:user] if defined? options[:user]
super(
:include => { :project_users => {}, :owner => { :only => [:id, :alias] } },
:methods => [ :path, :task_stats, :note_stats, :wiki_stats, :user_stats, :event_stats ]

0 comments on commit de72dc9

Please sign in to comment.