mimeo 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/mimeo/version.rb +1 -1
  2. data/lib/mimeo.rb +6 -4
  3. metadata +1 -1
data/lib/mimeo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mimeo
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/mimeo.rb CHANGED
@@ -2,10 +2,11 @@ require "mimeo/version"
2
2
 
3
3
  module Mimeo
4
4
  module ClassMethods
5
- def ohm_model(model, options = {})
5
+ def ohm_model(model, field_map)
6
6
  cattr_accessor :ohm_model_class, :ohm_model_index
7
7
 
8
8
  self.ohm_model_class = model
9
+ self.field_map = field_map
9
10
 
10
11
  self.set_callback :save, :after do
11
12
  self.save_to_redis
@@ -36,9 +37,10 @@ module Mimeo
36
37
  end
37
38
 
38
39
  def populate(record)
39
- self.class.accessible_attributes.to_a.reject{|a| a.blank?}.map{|a| a.to_sym}.each do |attr|
40
- val = self.send(attr)
41
- record.send("#{attr}=", val)
40
+ # self.class.accessible_attributes.to_a.reject{|a| a.blank?}.map{|a| a.to_sym}.each do |attr|
41
+ field_map.each do |rails_field, ohm_field|
42
+ val = self.send(rails_field)
43
+ record.send("#{ohm_field}=", val)
42
44
  record.rails_id = self.id
43
45
  end
44
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mimeo
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: