Hi All,
Can anybody clarify what's going on in this sample code?
I think that Module#include? needs to test that one module is included
into another.
It's correct for Simple B class and ActiveRecord ARChild class
but when I included DataMapper::Resource into StageItem class
something goes wrong.
Another moment if I comment #property :id, Serial
I receive exception
DataObjects::SyntaxError in 'StageItem types'
ERROR: syntax error at or near "FROM"
LINE 1: SELECT FROM "stage_items"
Why? I just want to test included Modules?
Thanks a lot for help in advance.
Roman
--------------
%w( rubygems spec dm-core dm-migrations dm-validations dm-transactions
benchmark active_record).each{|lib| require lib}
DataMapper.setup(:default, :adapter=>"postgres", :user=>"postgres",
:password=>"123", :host
=> "localhost", :path=>"/test0")
module Decor
end
class StageItem
include DataMapper::Resource
property :id, Serial
end
class SoilItem < StageItem
include Decor
end
class TreeItem < StageItem
include Decor
end
class A
end
class B < A
include Decor
end
class ARBase < ActiveRecord::Base
end
class ARChild < ARBase
include Decor
end
describe StageItem do
it 'types' do
p SoilItem.included_modules, SoilItem.include?(Decor)
p TreeItem.included_modules, TreeItem.include?(Kernel)
p B.included_modules, B.include?(Decor)
p ARChild.included_modules, ARChild.include?(Decor)
end
end
--
You received this message because you are subscribed to the Google Groups
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/datamapper?hl=en.