01:04
<knowtheory>
hmm, Zamous was having fail
01:04
<knowtheory>
and blamed dm :(
01:09
<dkubb>
yeah, that's too bad
01:10
<dkubb>
I would've helped him if he didn't split
01:10
<knowtheory>
hey dkubb
01:10
<dkubb>
knowtheory: hey
01:16
<dkubb>
I'm not entirely sure what his problem was, but I would've said that uniqueness has nothing to do with the intermediaries, but rather the target objects
01:16
<dkubb>
the result of most collection operations are a unique set of resources
01:17
<dkubb>
by default anyway, or it should be
01:17
<knowtheory>
i'm guessing it had to do w/ chaining stuff probably
01:17
<knowtheory>
instead of doing User.all.map{|u|u.items}
01:18
<knowtheory>
he was doing users = User.all; users.items
01:18
<knowtheory>
or something
01:18
<dkubb>
User.all.items works fine
01:18
<dkubb>
it would return a unique list of Item resources associated with at least one User
01:19
<knowtheory>
he was unhappy about having a uniqed list
01:19
<knowtheory>
yeah :)
01:19
<dkubb>
User.all.items(:unique => false)
01:19
<knowtheory>
hard to say w/o more feedback
01:22
<knowtheory>
yay my nexus one has shipped
01:34
<dkubb>
knowtheory: you thinking of doing dev for it?
01:35
<knowtheory>
thought about it, not seriously though. i need to get into more java dev in general i guess
01:35
<knowtheory>
or maybe using V8 to do JS dev for it
01:37
<knowtheory>
i'm joining the smartphone age :P
01:37
<knowtheory>
i haven't had one up to now
01:38
<knowtheory>
and wanted to get an unlocked phone
01:38
<dkubb>
I have been cell-phone free for a long time
01:38
<knowtheory>
otherwise i probably would have gotten an iphone
01:38
<knowtheory>
oh yeah? :)
01:38
<knowtheory>
i wanted a mobile computing devices that wasn't my laptop
01:38
<dkubb>
I'm plugged in all day long, when I am away from the computer I don't want to be plugged in then
01:38
<knowtheory>
because as much as i love my MBP hauling it out all the time isn't exactly the height of convenience, nor does it have mobile connectivity
01:38
<knowtheory>
yeah, i know how that feels
03:26
<myabc>
Anyone using Rails 3 + DM + multiple repositories?
04:55
ashley_moran joined
06:21
greeneggandham joined
06:25
greeneggandham joined
07:51
<knowtheory>
myabc: nope, Merb + DM + multirepo here
07:54
<myabc>
knowtheory: hey, how's it going?
07:54
<myabc>
knowtheory: do you have Merb::Plugins.config[:merb_datamapper][:use_repository_block] set to true?
07:54
<knowtheory>
hey hey
07:54
<myabc>
knowtheory: (default is true, AFAIK)
07:55
<knowtheory>
yeah, for merb i think the default is true, i'm just verifying to be sure
07:55
<knowtheory>
we do use multiple repository blocks. we've actually got it wrapped up in an object for convenience
07:55
<knowtheory>
yes, it's set to true
07:55
<knowtheory>
why out of curiosity?
07:59
<myabc>
knowtheory: well I partly resolved - or at least understand my problem now.. I was wondering why Model#default_repository_name was being observed in console, but not in controllers.
07:59
<myabc>
knowtheory: (this is the first time I've used this feature outside of a small Sinatra /CLI apps)
07:59
<knowtheory>
interesting
07:59
<myabc>
knowtheory: But I had missed the fact that Rails 3 (as Merb), Controller actions are wrapped in a repository block by default.
08:00
<knowtheory>
ah yeah.
08:00
<knowtheory>
the model we decided upon
08:00
<knowtheory>
was to always make the block one is operating in explicit
08:01
<knowtheory>
so our Application class requires knowing which repository to use, or it'll throw an exception
08:02
<myabc>
knowtheory: Oh, interesting.. that would make sense.
08:02
<isheridan>
Is anyone on that is familiar with over-riding accessors in a model class?
08:02
<knowtheory>
isheridan: like... overriding properties?
08:02
<knowtheory>
myabc: yeah we have a default repository just to make sure the app boots up, but otherwise, we don't use it.
08:02
<knowtheory>
isheridan: what are you overriding properties for?
08:03
<knowtheory>
my first question would be, should you rename your property, and create a method/accessor to point to the actual property you want to store stuff in?
08:03
<isheridan>
I have two properties that are Strings but I need have the output of the property transformed to an Array.
08:03
<knowtheory>
and my second question is, are you just trying to add behavior that could be accomplished using a before, or after block?
08:04
<knowtheory>
yeh in the event that i've had to do that i tend to have gone for the first option there
08:07
<isheridan>
knowtheory: When I initiate an object and populate it... all seems good. but when I try to save the new record "nothing" the save returns false but I can soo not error messages or anything that would enlighten me as to what I am doing wrong.
08:08
<isheridan>
knowtheory: see no errors that is
08:08
<knowtheory>
calling errors on the object doesn't return anything?
08:08
<knowtheory>
you can check the attributes hash
08:08
<isheridan>
one sec
08:08
<knowtheory>
and the dirty_attributes hash to see whether DM is aware that you've changed things
08:09
<namelessjon>
attribute_set takes care of dirtyness.
08:10
<isheridan>
hrmmm this is the error that I get ... :statuses=>["Statuses must be of type String"], :categories=>["Categories must be of type String"]
08:11
<isheridan>
when I look at the object I see this ... #<Filter @id=nil @name="Newly Imported" @statuses="1" @categories="" @start_date=nil @end_date=nil @is_default=true @is_temp=false @created_at=nil @updated_at=nil @user_id=1>
08:11
<knowtheory>
what happens when you call the "cateogries" method on the object?
08:12
<knowtheory>
it returns [""]?
08:12
<knowtheory>
I don't know enough about DM's save chain
08:12
<knowtheory>
do you namelessjon?
08:12
<isheridan>
yes but that is what I want
08:12
<knowtheory>
actually... call "attributes" on the filter
08:12
<knowtheory>
if you could
08:12
<isheridan>
well it returns []
08:12
<knowtheory>
and paste what the hash looks like
08:13
<isheridan>
{:categories=>[], :statuses=>["1"], :start_date=>nil, :user_id=>1, :created_at=>nil, :end_date=>nil, :is_default=>true, :is_temp=>false, :name=>"Newly Imported", :updated_at=>nil}
08:13
<knowtheory>
hehe :) interesting
08:14
<namelessjon>
Hmmm. the assignments should definitely be set when the method is called, not (i.e. before save even becomes involved)
08:14
<isheridan>
this is why I made sure to use "attribute_set"
08:16
<* namelessjon>
nods.
08:18
<isheridan>
While it is not the big a deal to work around this... I do not think that this was the intended behavior of "attribute_set" or the over-ride feature.
08:22
<namelessjon>
isheridan: It's definitely being called (the method)
08:24
<isheridan>
namelessjon: ah you tested it? yeah I thought so too.
08:26
<isheridan>
namelessjon: maybe the returned value should be the resulting string ... but what would "attribute_set" usefulness be? handling the dirty stuff?
08:26
<namelessjon>
Oh. Of course.
08:26
<namelessjon>
I figured it out, I think.
08:27
<namelessjon>
The validator calls your reader method.
08:27
<namelessjon>
When its checking its a string.
08:29
<isheridan>
namelessjon: so this means over-riding is useless for me and I should do the data transformation outside of the model object. hrmmm
08:31
<namelessjon>
isheridan: You can turn off auto_validation for that field.
08:31
<isheridan>
duh /smack
08:31
<namelessjon>
isheridan: That removes the primitive validator, and dm handles the saving as a string properly
08:35
<isheridan>
so basically in this circumstance one should set ":auto_validation => false" and make sure that you do your own validation in the over-riding method.
08:36
<knowtheory>
you can also add your on validator
08:36
<knowtheory>
which does what you want it to do
08:36
<knowtheory>
rather than what it thinks is the right thing to do of course
08:36
<isheridan>
yes of course
08:36
<isheridan>
good point
08:37
<isheridan>
Thank you both for your help
08:38
<isheridan>
I was taring my hair out trying to figure this out.
08:47
<andreich>
hello, please could someone point me to :dependent => :destroy in associations? I've searched the documentation but I haven't found where is this mentioned. The ticket on this is marked as resolved
08:48
<andreich>
I tried also with dm-constraints, but I get "condition :dependent does not map to a property or relationship" no matter what I include
08:49
<knowtheory>
sorry i do not know :(
08:52
<namelessjon>
andreich: :constraint => :destroy
08:52
<andreich>
just found it
08:52
<andreich>
thank you
11:34
<github>
datamapper.github.com: master Alex Coles * da9b532 (1 files in 1 dirs): Work-around a Maruku Markdown-parsing warning ... -
http://bit.ly/bK259z
11:37
<github>
datamapper.github.com: master Alex Coles * b3b55fb (1 files in 1 dirs): Fix typo in Properties documentation ... -
http://bit.ly/9e3qsi
13:59
<xshay>
hey I'm trying to get a complex aggregate function through DM
13:59
<xshay>
SELECT SUM(LEAST(20, value * 0.2)) FROM X WHERE Y
13:59
<xshay>
It doesn't seem this is possible?
14:24
<pjwal>
Is it possible to create a many to many relationship with a composite key for the many to many table?
15:34
<Tass`>
xshay, :value.least => 100 # probably
16:13
<g0bl1n>
hi, in OSX (Snow Leopard) I installed PostgreSQL EnterpiseDB package then: gem install do_postgres
16:14
<g0bl1n>
It installs fine
16:14
<g0bl1n>
when trying to connect to a local or remote Postgres server, I get:
16:14
<g0bl1n>
dyld: lazy symbol binding failed: Symbol not found: _PQsetdbLogin
16:15
<g0bl1n>
Referenced from: /Library/Ruby/Gems/1.8/gems/do_postgres-0.10.1/lib/do_postgres/do_postgres.bundle
16:15
<g0bl1n>
Expected in: flat namespace
16:15
<g0bl1n>
dyld: Symbol not found: _PQsetdbLogin
16:15
<g0bl1n>
any idea ?
17:43
<xshay>
Tass`: LEAST isn't an aggregation function, but my point was more "I have this random SQL function and want to push it through DM"
17:43
<xshay>
Tass`: would be nice to get all the query building and conditions and scope and stuff, and only drop down to raw SQL for the function
20:21
<chuck>
I can never get DataMapper.setup and DataMapper.auto_migrate! to work :(
20:21
<chuck>
DataMapper.setup(:default, "sqlite3://#{File.join(File.dirname(__FILE__), 'talker.db')}")
20:21
<chuck>
that's my setup line
20:22
<chuck>
and I'm calling DataMapper.auto_migrate! after I require my model files, but talker.db is not created
20:22
<chuck>
oh.. it's being created at / for some reason... hmm
20:27
beawesomeinstead joined
20:27
<namelessjon>
chuck: You probably want an File.expand_path in there.
20:28
<namelessjon>
chuck: or alternatively: "sqlite3:#{File.join(File.dirname(__FILE__), 'talker.db')}"
20:45
<chuck>
namelessjon, I threw expand_path in there, and it works, thanks!