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 CHANGED
@@ -1 +1 @@
1
- 0.9.3
1
+ 1.0.0
@@ -1,4 +1,5 @@
1
1
  require 'serialization_scopes/resolver'
2
+ require 'serialization_scopes/responder'
2
3
 
3
4
  module SerializationScopes
4
5
  extend ActiveSupport::Concern
@@ -0,0 +1,12 @@
1
+ module SerializationScopes
2
+ module Responder
3
+
4
+ def display(resource, given_options={})
5
+ if controller.respond_to?(:serialization_scope)
6
+ given_options.reverse_merge! :scope => controller.send(:serialization_scope)
7
+ end
8
+ super
9
+ end
10
+
11
+ end
12
+ end
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: 61
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 9
9
- - 3
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-07-04 00:00:00 +01:00
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
- - README
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.6.2
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"}