Hello everyone. when I am using & to make an intersection, it will work if I use one .all without arguments and one with arguments or two or more with arguments, but it won't work if I use one .all without arguments and then two or more with. This probably sounds confusing, so I made an example.
-------- require "dm-core" require "do_sqlite3" class Book include DataMapper::Resource property :id, Serial property :author, Text property :title, Text end DataMapper.setup(:default, 'sqlite3::memory:') Book.auto_migrate! Book.create(:author => "Vovin, Alexander", :title =>"A descriptive and comparative grammar of western old Japanese Part 1") Book.create(:author => "Vovin, Alexander", :title =>"Nihongo keitouron no genzai") Book.create(:author => "Vovin, Alexander", :title =>"A descriptive and comparative grammar of western old Japanese Part 2") result = Book.all(:author.like => "%vovin%") & Book.all(:author.like => "%Alexander%") result2 = Book.all & Book.all(:author.like => "%alex%") begin result3 = Book.all & Book.all(:author.like => "%Alexander%") & Book.all(:author.like => "%Vovin%") # This won't work rescue => e puts e end puts result.map(&:title) puts result2.map(&:title) puts result3.map(&:title) ------ The error it gives is "undefined method `intersection' for #<DataMapper::Query::Conditions::LikeComparison:0x00000001a2fe50>". Is there any deeper reason for this? -- Roger Braun http://rbraun.net [email protected] -- 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.
