lib/qooxview/entity.rb in qooxview-1.9.11 vs lib/qooxview/entity.rb in qooxview-1.9.13.pre.10
- old
+ new
@@ -29,11 +29,11 @@
:loading, :last_id, :is_loaded
def initialize
begin
@data_class = eval(singular(self.class.name))
- rescue Exception => e
+ rescue Exception
# Just in case the data-class is not created yet
eval("class #{singular(self.class.name)} < Entity\nend", TOPLEVEL_BINDING)
@data_class = eval(singular(self.class.name))
end
@storage = nil
@@ -171,11 +171,11 @@
# Makes for a small proxy, in that only the needed classes are
# instantiated - useful for stuff like long LDAP-lists...
def get_data_instance(k)
return nil if !k
- if k.class != Integer
+ if k.class.to_s !~ /(Integer|Fixnum)/
dputs(0) { 'This is very bad' }
dputs(0) { "value k is #{k.inspect} - #{k.class}" }
dputs(0) { "caller-stack is #{caller}" }
raise 'WrongIndex'
end
@@ -580,10 +580,10 @@
dputs(5) { "e is #{e.inspect} from #{@proxy.data.inspect}" }
if not raw and e
v = @proxy.get_value(f)
- if e.class == Integer and v and v.dtype == 'entity'
+ if (e.class.to_s =~ /(Integer|Fixnum)/) && v && v.dtype == 'entity'
dputs(5) { "Getting instance for #{v.inspect}" }
dputs(5) { "Getting instance with #{e.class} - #{e.inspect}" }
dputs(5) { "Field = #{field}; id = #{@id}" }
if e > 0 or @proxy.null_allowed
e = v.eclass.get_data_instance([e].flatten.first)