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
zombor has joined #datamapper
zombor has quit [Changing host]
zombor has joined #datamapper
zombor has quit [Remote host closed the connection]
Sylvain1 has quit [Quit: Leaving.]
kurko__ has quit [Quit: Computer has gone to sleep.]
kurko__ has joined #datamapper
endorama has joined #datamapper
endorama has quit [Client Quit]
v0n has joined #datamapper
rafaelfranca has quit [Remote host closed the connection]
snusnu has quit [Quit: Leaving.]
ckrailo has quit [Quit: Computer has gone to sleep.]
kurko__ has quit [Quit: Computer has gone to sleep.]
zombor has joined #datamapper
zombor has quit [Remote host closed the connection]
<kapowaz>
I've added a belongs_to relationship to a model that already has a few rows, but now DM is throwing an error about the column having null values… how can I work around that ?
<mralk3>
does anyone have a good site i can look at to learn how to import csv files into a sql database using data mapper?
<mralk3>
google is coming up with a bunch of garbage
lnormous has quit [Ping timeout: 256 seconds]
<dkubb>
!memo mbj would you mind checkout out https://github.com/mbj/mutant/pull/74 .. I think it's ready to merge. I'd rather see it merged in early and then small naming tweaks made later than holding it up for surface level stuff
<Cinchy>
dkubb: Memo recorded for mbj.
<dkubb>
mralk3: I would just use FasterCSV, parse each line of the CSV and use DM as normal to create it. I see lots of examples on stackoverflow
<dkubb>
I don't much like mixing in import logic into models tbh
v0n has joined #datamapper
<mralk3>
alirght, i will take a look at fastercsv
<mralk3>
thanks much
mbj has joined #datamapper
lnormous has joined #datamapper
v0n has quit [Quit: WeeChat 0.4.1]
v0n has joined #datamapper
<mbj>
.
<Cinchy>
mbj: [22m 31s ago] <dkubb> would you mind checkout out https://github.com/mbj/mutant/pull/74 .. I think it's ready to merge. I'd rather see it merged in early and then small naming tweaks made later than holding it up for surface level stuff
mbj has quit [Read error: Connection reset by peer]
mbj has joined #datamapper
rsim has quit [Quit: Leaving.]
mbj has quit [Read error: Connection reset by peer]
mbj has joined #datamapper
mbj has quit [Read error: Connection reset by peer]
postmodern has joined #datamapper
rtyler_ has joined #datamapper
rtyler has quit [Read error: Connection reset by peer]
v0n has quit [Ping timeout: 246 seconds]
rafaelfranca has quit [Remote host closed the connection]
rtyler_ is now known as rtyler
v0n has joined #datamapper
zombor has quit [Remote host closed the connection]
rsim has joined #datamapper
rsim has quit [Ping timeout: 240 seconds]
solnic has quit [Quit: Leaving...]
bobocopy has quit [Quit: Leaving.]
bobocopy has joined #datamapper
bobocopy has quit [Client Quit]
zombor has joined #datamapper
zombor has quit [Ping timeout: 248 seconds]
<_br_>
Anyone have an idea how to turn an array into a DataMapper::Collection ?
<_br_>
I ask because I want to leverage the nifty dm-pager and it requires a DataMapper::Collection I think.
<onewheelskyward>
_br_ Yes. fill the array with DataMapper Resources. e.g. Model.all()
<_br_>
onewheelskyward: I don't fully follow. The array already contains objects etc. How would I wrap these objects in Model.all() ?
<onewheelskyward>
Well, my point is that the dm-pager expects datamapper resources.
<_br_>
Hm
<onewheelskyward>
If you already have an array, you should find a more generic pagination solution.
<_br_>
I see, that makes sense
<onewheelskyward>
Or, get your data from datamapper.
<onewheelskyward>
There have to be a number of pagination gems out there.
<_br_>
Not really possible unfortuantely, because I'm doing some complex sorting after getting some data from DM, hence the output being an array
<_br_>
true that, thanks for the advice onewheelskyward. Really appreciate it!
<onewheelskyward>
aaah interesting
<onewheelskyward>
Can you sort it and leave the collection intact?
<_br_>
Yes, you get my problem.
<onewheelskyward>
Right, you'd have to recreate the collection.
<onewheelskyward>
Hmm.
<_br_>
exactly.
<_br_>
I'm wondering how to get that baked, because each object is a DataMapper object but the surrounding array is not a DataMapper::Collection
<onewheelskyward>
oh..."A Collection should act like an Array in every way, except that it will attempt to defer loading until the results from the repository are needed.
<onewheelskyward>
"
<onewheelskyward>
I'd likely rethink it to either sort straight from the database or not us dm-pager.
<onewheelskyward>
Since you already have the data you don't need the lazy loading.
<_br_>
true
<namelessjon>
I'm pretty sure you can #sort on a DM::Collection and it will be a collection still.
<_br_>
I'm playing with different methods from DataMapper::Collection but seems different gem is probably better
<_br_>
hm
<namelessjon>
It will trigger the loading of the resources, but it will still be a collection.
<_br_>
yes, maybe need to work with that instead
<_br_>
Thanks for the feedback! I'm digging into this deeper now...
<onewheelskyward>
Good luck. :)
<_br_>
cheers! :)
kurko__ has quit [Quit: Computer has gone to sleep.]