dkubb changed the topic of #datamapper to: Datamapper v1.2.0 | Mailing List: http://is.gd/aa9D | Logs: http://is.gd/qWAL7V | DataMapper 2 Renamed to ROM, see #rom-rb for development
brianpWins has quit [Quit: brianpWins]
kapowaz has quit [Ping timeout: 246 seconds]
grandy has quit [Ping timeout: 256 seconds]
zombor has joined #datamapper
noca has quit [Ping timeout: 246 seconds]
jpr5 has joined #datamapper
zombor has quit [Remote host closed the connection]
snusnu has quit [Quit: Leaving.]
skade has quit [Quit: Computer has gone to sleep.]
zombor has joined #datamapper
zombor has quit [Ping timeout: 256 seconds]
rsim has joined #datamapper
rsim has quit [Ping timeout: 240 seconds]
grandy has joined #datamapper
zombor has joined #datamapper
kapowaz has joined #datamapper
kapowaz has quit [Ping timeout: 248 seconds]
grandy has quit [Ping timeout: 264 seconds]
zombor has quit [Remote host closed the connection]
brianpWins has joined #datamapper
rsim has joined #datamapper
rsim has quit [Ping timeout: 240 seconds]
grandy has joined #datamapper
kapowaz has joined #datamapper
mbj has joined #datamapper
skade has joined #datamapper
vockav has joined #datamapper
<vockav> I have a flag property in my table. I would like to fetch records based on the flag value. I searched the internet, but found no solution.
<onewheelskyward> Model.all(flag: true)?
rsim has joined #datamapper
<vockav> flag is not a boolean value. The property name is colors, and it can have values [:blue, :green, :yellow, :red]. It can have one or more than one value.
<vockav> Now, i want to search records that have either :blue or :red, or both
<onewheelskyward> ok, Model.all(flag: [:blue, :red]
<onewheelskyward> oh wait
<onewheelskyward> how are you doing the one to many? Join table?
<onewheelskyward> If the relationships are configured, you should be able to say Model.all(model.color: [:red, :blue]) I *think*
<vockav> no, its not a one to many relation. Colors is not a table. By default, flag properties can hold one or more values. http://datamapper.org/docs/dm_more/types.html
<onewheelskyward> Punch the query output to max with DataMapper::Logger.new($stdout, :debug)
<onewheelskyward> Oh, a flag type, I see what you're saying now.
<vockav> yes
<onewheelskyward> So what if you do Model,all(colours: [:red, :blue]), what's the resulting sql?
mbj has quit [Ping timeout: 240 seconds]
<onewheelskyward> I'm guessing it's doing bit shifting in a data field.
<vockav> it works only if a record has one color. For e.g., Model.all(colours => [:red]) returns all records having color as red. But not the records that have red and blue
<onewheelskyward> interesting.
<onewheelskyward> What does the sql look like for that?
<vockav> Also, Model.all(colours: [:red, :blue]) does not return records having color as red and blue
<vockav> Do you want me to paste the query here, or else where?
<onewheelskyward> Gist it.
<onewheelskyward> or a pastebin of your choice.
<vockav> ok
<onewheelskyward> and what's the value of the color field of a record with blue and red?
skade has quit [Quit: Computer has gone to sleep.]
<onewheelskyward> I'm guessing 6
<vockav> 6
<vockav> yes
<onewheelskyward> interesting,
<onewheelskyward> So really, what you want that to say is where color in (2,4,6)
<vockav> yes
<onewheelskyward> how about a conditions field?
<vockav> as in?
<onewheelskyward> :conditions => ['color = ? or color = ? or color = ?', :red, :blue, :red + :blue] ?
<vockav> oh
<vockav> let me try
<onewheelskyward> Not really scalable but I'm curious if it works
<onewheelskyward> if it does, you can probably put red+blue in your array.
vockav has quit [Read error: Operation timed out]
vockav has joined #datamapper
<vockav> :conditions => ['car_category = ? or car_category = ? or car_category = ?', 2, 4,[6]] works!
<vockav> but, :conditions => ['car_category = ? or car_category = ? or car_category = ?', 2, 4,[2,4]] doesnt!
<vockav> <vockav> and it works only with integer values.. :conditions => ['color = ? or color = ? or color = ?', :red, :blue, :red + :blue] fails
<vockav> what is this 2,4,6 actually in flags? is it the index or something?
<vockav> ?
vockav has quit [Quit: Leaving]
mikecmpbll has joined #datamapper
skade has joined #datamapper
skade has quit [Quit: Computer has gone to sleep.]
skade has joined #datamapper
mikecmpbll has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
snusnu has joined #datamapper
postmodern has quit [Quit: Leaving]
snusnu has quit [Quit: Leaving.]
mikecmpbll has joined #datamapper
rsim has quit [Quit: Leaving.]
rsim has joined #datamapper
zombor has joined #datamapper
akasper has joined #datamapper
mikecmpbll has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
mikecmpbll has joined #datamapper
zombor has quit [Ping timeout: 252 seconds]
snusnu has joined #datamapper
zombor_ has joined #datamapper
zombor_ is now known as zombor
mbj has joined #datamapper
knowtheory has quit [Quit: Computer has gone to sleep]
lgierth has joined #datamapper
lgierth has quit [Client Quit]
lgierth has joined #datamapper
mikecmpbll has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
mikecmpbll has joined #datamapper
rtyler_ has joined #datamapper
rtyler has quit [Read error: Connection reset by peer]
mikecmpbll has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
skade has quit [Quit: Computer has gone to sleep.]
brianpWins has quit [Quit: brianpWins]
rsim has quit [Quit: Leaving.]
zombor has quit [Remote host closed the connection]
zombor has joined #datamapper
brianpWins has joined #datamapper
lgierth has quit [Quit: Ex-Chat]
rtyler_ is now known as rtyler
rsim has joined #datamapper
rsim has quit [Ping timeout: 241 seconds]
skade has joined #datamapper
skade has quit [Quit: Computer has gone to sleep.]
rsim has joined #datamapper
rsim has quit [Ping timeout: 240 seconds]
rsim has joined #datamapper
lgierth has joined #datamapper
rsim has quit [Quit: Leaving.]
skade has joined #datamapper
skade has quit [Client Quit]
lgierth has quit [Ping timeout: 260 seconds]
postmodern has joined #datamapper
rsim has joined #datamapper
mbj has quit [Ping timeout: 260 seconds]
snusnu has quit [Quit: Leaving.]
skade has joined #datamapper
v0n has quit [Ping timeout: 245 seconds]
snusnu has joined #datamapper
snusnu1 has joined #datamapper
snusnu1 has quit [Client Quit]
snusnu has quit [Ping timeout: 264 seconds]
snusnu has joined #datamapper
dbussink has quit [Ping timeout: 268 seconds]
dbussink has joined #datamapper
skade has quit [Quit: Computer has gone to sleep.]
skade has joined #datamapper
zombor has quit [Remote host closed the connection]
skade has quit [Quit: Computer has gone to sleep.]
Eiam has quit [Ping timeout: 260 seconds]
Eiam has joined #datamapper
rsim has quit [Quit: Leaving.]
akasper has quit [Quit: Leaving.]