has_metadata 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -1,7 +1,7 @@
1
1
  h1. has_metadata -- Keep your tables narrow
2
2
 
3
3
  | *Author* | Tim Morgan |
4
- | *Version* | 1.3 (Aug 30, 2011) |
4
+ | *Version* | 1.4 (Oct 30, 2011) |
5
5
  | *License* | Released under the MIT License. |
6
6
 
7
7
  h2. Important note for those upgrading from 1.0 to 1.1
data/has_metadata.gemspec CHANGED
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{has_metadata}
8
- s.version = "1.3.0"
7
+ s.name = "has_metadata"
8
+ s.version = "1.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Tim Morgan}]
12
- s.date = %q{2011-08-31}
13
- s.description = %q{has_metadata lets you move non-indexed and weighty columns off of your big tables by creating a separate metadata table to store all this extra information. Works with Ruby 1.9. and Rails 3.0.}
14
- s.email = %q{git@timothymorgan.info}
11
+ s.authors = ["Tim Morgan"]
12
+ s.date = "2011-10-31"
13
+ s.description = "has_metadata lets you move non-indexed and weighty columns off of your big tables by creating a separate metadata table to store all this extra information. Works with Ruby 1.9. and Rails 3.0."
14
+ s.email = "git@timothymorgan.info"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
17
  "README.textile"
@@ -26,11 +26,11 @@ Gem::Specification.new do |s|
26
26
  "templates/create_metadata.rb",
27
27
  "templates/metadata.rb"
28
28
  ]
29
- s.homepage = %q{http://github.com/riscfuture/has_metadata}
30
- s.require_paths = [%q{lib}]
29
+ s.homepage = "http://github.com/riscfuture/has_metadata"
30
+ s.require_paths = ["lib"]
31
31
  s.required_ruby_version = Gem::Requirement.new(">= 1.9")
32
- s.rubygems_version = %q{1.8.9}
33
- s.summary = %q{Reduce your table width by moving non-indexed columns to a separate metadata table}
32
+ s.rubygems_version = "1.8.11"
33
+ s.summary = "Reduce your table width by moving non-indexed columns to a separate metadata table"
34
34
 
35
35
  if s.respond_to? :specification_version then
36
36
  s.specification_version = 3
data/lib/has_metadata.rb CHANGED
@@ -96,6 +96,18 @@ module HasMetadata
96
96
 
97
97
  module InstanceMethods
98
98
 
99
+ def as_json(options={})
100
+ options[:except] = Array.wrap(options[:except]) + [ :metadata_id ]
101
+ options[:methods] = Array.wrap(options[:methods]) + metadata_fields.keys - options[:except].map(&:to_sym)
102
+ super options
103
+ end
104
+
105
+ def to_xml(options={})
106
+ options[:except] = Array.wrap(options[:except]) + [ :metadata_id ]
107
+ options[:methods] = Array.wrap(options[:methods]) + metadata_fields.keys - options[:except].map(&:to_sym)
108
+ super options
109
+ end
110
+
99
111
  # @private
100
112
  def assign_multiparameter_attributes(pairs)
101
113
  fake_attributes = pairs.select { |(field, _)| self.class.metadata_fields.include? field[0, field.index('(')].to_sym }
@@ -1,11 +1,7 @@
1
1
  class CreateMetadata < ActiveRecord::Migration
2
- def self.up
2
+ def change
3
3
  create_table :metadata do |t|
4
4
  t.text :data, null: false
5
5
  end
6
6
  end
7
-
8
- def self.down
9
- drop_table :metadatas
10
- end
11
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_metadata
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-31 00:00:00.000000000Z
12
+ date: 2011-10-31 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2173498820 !ruby/object:Gem::Requirement
16
+ requirement: &2154906620 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2173498820
24
+ version_requirements: *2154906620
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: boolean
27
- requirement: &2173498260 !ruby/object:Gem::Requirement
27
+ requirement: &2154905980 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2173498260
35
+ version_requirements: *2154905980
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jeweler
38
- requirement: &2173358180 !ruby/object:Gem::Requirement
38
+ requirement: &2154905400 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2173358180
46
+ version_requirements: *2154905400
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: yard
49
- requirement: &2173357580 !ruby/object:Gem::Requirement
49
+ requirement: &2154904760 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2173357580
57
+ version_requirements: *2154904760
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: RedCloth
60
- requirement: &2173356920 !ruby/object:Gem::Requirement
60
+ requirement: &2154890900 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2173356920
68
+ version_requirements: *2154890900
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sqlite3
71
- requirement: &2173356440 !ruby/object:Gem::Requirement
71
+ requirement: &2154890420 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2173356440
79
+ version_requirements: *2154890420
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &2173355920 !ruby/object:Gem::Requirement
82
+ requirement: &2154889860 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2173355920
90
+ version_requirements: *2154889860
91
91
  description: has_metadata lets you move non-indexed and weighty columns off of your
92
92
  big tables by creating a separate metadata table to store all this extra information.
93
93
  Works with Ruby 1.9. and Rails 3.0.
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  requirements: []
128
128
  rubyforge_project:
129
- rubygems_version: 1.8.9
129
+ rubygems_version: 1.8.11
130
130
  signing_key:
131
131
  specification_version: 3
132
132
  summary: Reduce your table width by moving non-indexed columns to a separate metadata