Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
82c8c42a
Commit
82c8c42a
authored
Apr 04, 2012
by
randx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move all serialization to marshall
parent
11e4709f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
24 deletions
+18
-24
app/models/event.rb
app/models/event.rb
+10
-1
app/models/gitlab_serialize.rb
app/models/gitlab_serialize.rb
+0
-23
app/models/merge_request.rb
app/models/merge_request.rb
+8
-0
No files found.
app/models/event.rb
View file @
82c8c42a
...
@@ -14,7 +14,8 @@ class Event < ActiveRecord::Base
...
@@ -14,7 +14,8 @@ class Event < ActiveRecord::Base
belongs_to
:project
belongs_to
:project
belongs_to
:target
,
:polymorphic
=>
true
belongs_to
:target
,
:polymorphic
=>
true
serialize
:data
,
GitlabSerialize
.
new
# For Hash only
serialize
:data
scope
:recent
,
order
(
"created_at DESC"
)
scope
:recent
,
order
(
"created_at DESC"
)
scope
:code_push
,
where
(
:action
=>
Pushed
)
scope
:code_push
,
where
(
:action
=>
Pushed
)
...
@@ -104,6 +105,14 @@ class Event < ActiveRecord::Base
...
@@ -104,6 +105,14 @@ class Event < ActiveRecord::Base
delegate
:name
,
:email
,
:to
=>
:author
,
:prefix
=>
true
,
:allow_nil
=>
true
delegate
:name
,
:email
,
:to
=>
:author
,
:prefix
=>
true
,
:allow_nil
=>
true
delegate
:title
,
:to
=>
:issue
,
:prefix
=>
true
,
:allow_nil
=>
true
delegate
:title
,
:to
=>
:issue
,
:prefix
=>
true
,
:allow_nil
=>
true
delegate
:title
,
:to
=>
:merge_request
,
:prefix
=>
true
,
:allow_nil
=>
true
delegate
:title
,
:to
=>
:merge_request
,
:prefix
=>
true
,
:allow_nil
=>
true
def
load
obj
Marshal
.
load
obj
end
def
dump
obj
Marshal
.
dump
obj
end
end
end
# == Schema Information
# == Schema Information
#
#
...
...
app/models/gitlab_serialize.rb
deleted
100644 → 0
View file @
11e4709f
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
YAML
.
load
(
data
)
rescue
Psych
::
SyntaxError
nil
end
end
# Called to convert from ruby object to serialized data.
def
dump
(
obj
)
JSON
.
dump
(
obj
)
end
end
app/models/merge_request.rb
View file @
82c8c42a
...
@@ -144,6 +144,14 @@ class MergeRequest < ActiveRecord::Base
...
@@ -144,6 +144,14 @@ class MergeRequest < ActiveRecord::Base
:author_id
=>
user_id
:author_id
=>
user_id
)
)
end
end
def
load
obj
Marshal
.
load
obj
end
def
dump
obj
Marshal
.
dump
obj
end
end
end
# == Schema Information
# == Schema Information
#
#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment