lib/flapjack/data/entity.rb in flapjack-0.6.38 vs lib/flapjack/data/entity.rb in flapjack-0.6.39

- old
+ new

@@ -10,11 +10,11 @@ def self.all(options = {}) raise "Redis connection not set" unless redis = options[:redis] redis.keys("entity_id:*").collect {|k| k =~ /^entity_id:(.+)$/; entity_name = $1 - self.new(:name => entity_name, :id => redis.get("entity_id:#{entity_name}").to_i, :redis => redis) + self.new(:name => entity_name, :id => redis.get("entity_id:#{entity_name}"), :redis => redis) } end # NB: should probably be called in the context of a Redis multi block; not doing so # here as calling classes may well be adding/updating multiple records in the one @@ -49,10 +49,10 @@ # key doesn't exist return unless options[:create] self.add({'name' => entity_name}, :redis => redis) end self.new(:name => entity_name, - :id => (entity_id.nil? || entity_id.empty?) ? nil : entity_id.to_i, + :id => (entity_id.nil? || entity_id.empty?) ? nil : entity_id, :redis => redis) end def self.find_by_id(entity_id, options = {}) raise "Redis connection not set" unless redis = options[:redis]