ninja-model 0.5.4 → 0.5.5
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.
@@ -1,5 +1,6 @@
|
|
1
1
|
module NinjaModel
|
2
2
|
class Base
|
3
|
+
class UnknownAttributeError < NinjaModelError; end
|
3
4
|
include ActiveModel::AttributeMethods
|
4
5
|
include ActiveModel::Dirty
|
5
6
|
|
@@ -84,7 +85,7 @@ module NinjaModel
|
|
84
85
|
attributes = new_attributes.stringify_keys
|
85
86
|
|
86
87
|
attributes.each do |k,v|
|
87
|
-
respond_to?("#{k}=".to_sym) ? send("#{k}=".to_sym, v) : raise(UnknownAttributeError, "unknown attribute: #{k}")
|
88
|
+
respond_to?("#{k}=".to_sym) ? send("#{k}=".to_sym, v) : raise(NinjaModel::Base::UnknownAttributeError, "unknown attribute: #{k}")
|
88
89
|
end
|
89
90
|
end
|
90
91
|
|
@@ -81,6 +81,14 @@ module NinjaModel
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
+
def respond_to?(sym)
|
85
|
+
if self.class.read_inheritable_attribute(:proxy) && proxy.respond_to?(sym)
|
86
|
+
true
|
87
|
+
else
|
88
|
+
super
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
84
92
|
def method_missing(method, *args)
|
85
93
|
if self.class.read_inheritable_attribute(:proxy) && proxy.respond_to?(method)
|
86
94
|
proxy.send(method, *args)
|
@@ -104,7 +112,7 @@ module NinjaModel
|
|
104
112
|
end
|
105
113
|
end
|
106
114
|
|
107
|
-
@proxy_klass = ninja_model.parent.const_set("#{@klass.model_name}Proxy", Class.new(ActiveRecord::Base))
|
115
|
+
@proxy_klass = ninja_model.parent.const_set("#{@klass.model_name.gsub(/[^a-zA-Z]/, '')}Proxy", Class.new(ActiveRecord::Base))
|
108
116
|
@proxy_klass.class_eval do
|
109
117
|
cattr_accessor :columns
|
110
118
|
self.columns = []
|
data/lib/ninja_model/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ninja-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 5
|
10
|
+
version: 0.5.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Josh Williams
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-29 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|