serialization_scopes 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,2 +1 @@
1
- Gemfile.lock
2
1
  pkg/
data/Gemfile.lock ADDED
@@ -0,0 +1,26 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activerecord (2.3.8)
5
+ activesupport (= 2.3.8)
6
+ activesupport (2.3.8)
7
+ gemcutter (0.6.1)
8
+ git (1.2.5)
9
+ jeweler (1.4.0)
10
+ gemcutter (>= 0.1.0)
11
+ git (>= 1.2.5)
12
+ rubyforge (>= 2.0.0)
13
+ json_pure (1.4.6)
14
+ rake (0.8.7)
15
+ rspec (1.3.0)
16
+ rubyforge (2.0.4)
17
+ json_pure (>= 1.1.7)
18
+
19
+ PLATFORMS
20
+ ruby
21
+
22
+ DEPENDENCIES
23
+ activerecord (< 3.0.0)
24
+ jeweler
25
+ rake
26
+ rspec
data/README ADDED
@@ -0,0 +1,20 @@
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"}
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -31,3 +31,7 @@ module SerializationScopes
31
31
  end
32
32
 
33
33
  end
34
+
35
+ ActiveRecord::Base.class_eval do
36
+ include SerializationScopes
37
+ end
data/rails/init.rb CHANGED
@@ -1,4 +1 @@
1
1
  require 'serialization_scopes'
2
- ActiveRecord::Base.class_eval do
3
- include SerializationScopes
4
- end
@@ -5,16 +5,21 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{serialization_scopes}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dimitrij Denissenko"]
12
12
  s.date = %q{2010-08-19}
13
13
  s.description = %q{Adds named scopes for ActiveRecord serialization methods (to_xml, to_json)}
14
14
  s.email = %q{dimitrij@blacksquaremedia.com}
15
+ s.extra_rdoc_files = [
16
+ "README"
17
+ ]
15
18
  s.files = [
16
19
  ".gitignore",
17
20
  "Gemfile",
21
+ "Gemfile.lock",
22
+ "README",
18
23
  "Rakefile",
19
24
  "VERSION",
20
25
  "lib/serialization_scopes.rb",
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: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dimitrij Denissenko
@@ -48,11 +48,13 @@ executables: []
48
48
 
49
49
  extensions: []
50
50
 
51
- extra_rdoc_files: []
52
-
51
+ extra_rdoc_files:
52
+ - README
53
53
  files:
54
54
  - .gitignore
55
55
  - Gemfile
56
+ - Gemfile.lock
57
+ - README
56
58
  - Rakefile
57
59
  - VERSION
58
60
  - lib/serialization_scopes.rb