serialization_scopes 0.9.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/serialization_scopes.rb +1 -0
- data/lib/serialization_scopes/responder.rb +12 -0
- metadata +9 -11
- data/README +0 -20
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0
|
data/lib/serialization_scopes.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serialization_scopes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
|
10
|
-
version: 0.9.3
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dimitrij Denissenko
|
@@ -16,8 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
20
|
-
default_executable:
|
19
|
+
date: 2011-08-29 00:00:00 Z
|
21
20
|
dependencies: []
|
22
21
|
|
23
22
|
description: Adds named scopes for ActiveRecord/ActiveResource serialization methods (to_xml, to_json)
|
@@ -30,13 +29,12 @@ extra_rdoc_files: []
|
|
30
29
|
|
31
30
|
files:
|
32
31
|
- VERSION
|
33
|
-
-
|
34
|
-
- lib/serialization_scopes.rb
|
32
|
+
- lib/serialization_scopes/responder.rb
|
35
33
|
- lib/serialization_scopes/resolver.rb
|
36
|
-
- lib/serialization_scopes/matchers/serialize_matcher.rb
|
37
34
|
- lib/serialization_scopes/matchers.rb
|
35
|
+
- lib/serialization_scopes/matchers/serialize_matcher.rb
|
36
|
+
- lib/serialization_scopes.rb
|
38
37
|
- rails/init.rb
|
39
|
-
has_rdoc: true
|
40
38
|
homepage: http://github.com/dim/serialization_scopes
|
41
39
|
licenses: []
|
42
40
|
|
@@ -70,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
68
|
requirements: []
|
71
69
|
|
72
70
|
rubyforge_project:
|
73
|
-
rubygems_version: 1.
|
71
|
+
rubygems_version: 1.8.5
|
74
72
|
signing_key:
|
75
73
|
specification_version: 3
|
76
74
|
summary: Named scopes for ActiveRecord/ActiveResource serialization methods (to_xml, to_json)
|
data/README
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
== Serialization Scopes
|
2
|
-
|
3
|
-
Define scopes for XML/JSON serialization of your ActiveRecord models. Examples:
|
4
|
-
|
5
|
-
# Model - column names: id, title, body, date, personal_notes, comments_count
|
6
|
-
class Article < ActiveRecord::Base
|
7
|
-
has_many :comments
|
8
|
-
|
9
|
-
serialization_scope :author, :except => [:comments_count]
|
10
|
-
serialization_scope :reader, :only => [:title, :body, :date], :include => [:comments]
|
11
|
-
end
|
12
|
-
|
13
|
-
Article.first.to_json
|
14
|
-
# => {"id":1,"title":"Hello","body":"World","date":"2010-01-01","personal_notes":"Author's notes","comments_count":3}
|
15
|
-
|
16
|
-
Article.first.to_json(:scope => :author)
|
17
|
-
# => {"id":1,"title":"Hello","body":"World","date":"2010-01-01","personal_notes":"Author's notes"}
|
18
|
-
|
19
|
-
Article.first.to_json(:scope => :author, :only => [:title])
|
20
|
-
# => {"title":"Hello"}
|