serialist 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/serialist/serialist_module.rb +19 -4
- data/serialist.gemspec +2 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.0
|
@@ -15,7 +15,21 @@ module Serialist
|
|
15
15
|
serialize(@serialist_field, Hash)
|
16
16
|
|
17
17
|
if serialist_options.empty?
|
18
|
+
# catch-all mode
|
18
19
|
include Serialist::InstanceMethods
|
20
|
+
class_eval do
|
21
|
+
# alias method chaining
|
22
|
+
unless method_defined? :method_missing
|
23
|
+
def method_missing(meth, *args, &block); super; end
|
24
|
+
end
|
25
|
+
alias_method :old_method_missing, :method_missing
|
26
|
+
alias_method :method_missing, :serialist_method_missing
|
27
|
+
unless method_defined?(:attributes=)
|
28
|
+
def attributes=(meth, *args, &block); super; end
|
29
|
+
end
|
30
|
+
alias_method :old_attributes=, :attributes=
|
31
|
+
alias_method :attributes=, :serialist_attributes=
|
32
|
+
end
|
19
33
|
else
|
20
34
|
@serialist_options.each do |field|
|
21
35
|
cols = self.columns.map{|c|c.name.to_s}
|
@@ -60,7 +74,9 @@ module Serialist
|
|
60
74
|
end
|
61
75
|
|
62
76
|
module InstanceMethods
|
63
|
-
|
77
|
+
|
78
|
+
# needed because AR checks with respond_to when doing mass assignment.
|
79
|
+
def serialist_attributes=(new_attributes, guard_protected_attributes = true)
|
64
80
|
return if new_attributes.nil?
|
65
81
|
attributes = new_attributes.dup
|
66
82
|
attributes.stringify_keys!
|
@@ -70,11 +86,10 @@ module Serialist
|
|
70
86
|
self.class.define_access_method(k) unless respond_to?(k) # for validation
|
71
87
|
end
|
72
88
|
end
|
73
|
-
|
89
|
+
self.send(:old_attributes=, new_attributes, guard_protected_attributes = true)
|
74
90
|
end
|
75
91
|
|
76
|
-
|
77
|
-
def method_missing(method, *args, &block)
|
92
|
+
def serialist_method_missing(method, *args, &block)
|
78
93
|
begin
|
79
94
|
old_method_missing(method, *args, &block)
|
80
95
|
rescue NoMethodError
|
data/serialist.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{serialist}
|
8
|
-
s.version = "1.
|
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
11
|
s.authors = ["Benoit B\303\251n\303\251zech"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-23}
|
13
13
|
s.description = %q{Serialize any data, set and fetch it like any column attributes}
|
14
14
|
s.email = %q{benoit.benezech@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serialist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Benoit B\xC3\xA9n\xC3\xA9zech"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-23 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|