edr 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/edr/registry.rb +8 -6
  2. data/lib/edr/version.rb +1 -1
  3. metadata +1 -1
data/lib/edr/registry.rb CHANGED
@@ -20,23 +20,25 @@ module Edr
20
20
  self.instance_eval &block
21
21
  end
22
22
 
23
+ # the mapping is done by the class names, to avoid
24
+ # class-reloading issues in Rails dev mode
23
25
  def map model_class, data_class
24
- @model_to_data_map[model_class] = data_class
25
- @data_to_model_map[data_class] = model_class
26
+ @model_to_data_map[model_class.to_s] = data_class.to_s
27
+ @data_to_model_map[data_class.to_s] = model_class.to_s
26
28
  end
27
29
 
28
30
  def data_class_for model_class
29
- data_class = @model_to_data_map[model_class]
31
+ data_class = @model_to_data_map[model_class.to_s]
30
32
  return OpenStruct unless data_class
31
33
 
32
- data_class
34
+ data_class.constantize
33
35
  end
34
36
 
35
37
  def model_class_for data_class
36
- model_class = @data_to_model_map[data_class]
38
+ model_class = @data_to_model_map[data_class.to_s]
37
39
  raise "No model class for #{data_class.to_s}" unless model_class
38
40
 
39
- model_class
41
+ model_class.constantize
40
42
  end
41
43
 
42
44
  private
data/lib/edr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Edr
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: