mamechiwa 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Mamechiwa
2
2
  module Version
3
- STRING = "0.0.0"
3
+ STRING = "0.0.1"
4
4
  end
5
5
  end
data/lib/mamechiwa.rb CHANGED
@@ -28,7 +28,10 @@ module Mamechiwa
28
28
  define_method :initialize_with_mame do
29
29
  unless @mame_embedded
30
30
  group = self.class.mame_group_field.size > 0 ? self.send(self.class.mame_group_field).to_s : ""
31
- @mame_embedded = self.class.mame_config[group][:class].new(self, field)
31
+
32
+ if self.class.mame_config[group] && self.class.mame_config[group][:class]
33
+ @mame_embedded = self.class.mame_config[group][:class].new(self, field)
34
+ end
32
35
  end
33
36
  end
34
37
 
@@ -42,10 +45,14 @@ module Mamechiwa
42
45
 
43
46
  define_method :mame_validator do
44
47
  initialize_with_mame
45
-
46
- if !@mame_embedded.valid?
47
- @mame_embedded.errors.each do |k, v|
48
- errors.add("#{field}[#{k}]", v)
48
+
49
+ unless @mame_embedded
50
+ errors.add("#{field}", "#{self.class.mame_group_field} is unregistered type.")
51
+ else
52
+ if !@mame_embedded.valid?
53
+ @mame_embedded.errors.each do |k, v|
54
+ errors.add("#{field}[#{k}]", v)
55
+ end
49
56
  end
50
57
  end
51
58
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mamechiwa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: