[DataMapper] Re: Documentation patches wanted
Thanks, Martin for updating the Docs. The new comments are very very helpful! I was looking for these. My comments are related to the datamapper.org/docs/associations: 1. Declaring Associations: Is there a detail explanation of the naming convention (i.e. pluralization, etc.) used by DM? 2. Most of the example models missed at least one property and DataMapper::auto_migrate! would complain: DataMapper::IncompleteModelError: Blog must have at least one property Is it assumed that reader knows what to fill in or am I missing something? I'm very new to DM and like to help to improve it from a user perspective, but don't know where to start. Thanks. On Jul 18, 7:00 am, Martin Gamsjaeger gamsnj...@gmail.com wrote: Kevin, On Sun, Jul 18, 2010 at 07:50, Kevin inspir...@gmail.com wrote: It'd be nice ifhttp://datamapper.org/docs/associationsincluded mention of the name of the Resource table created, which keys/etc. Or how to auto_migrate! it to get it created.. As is, its rather hard to actually 'get started' with it. There is an actual 'Getting Started' section containing at least some of the information you mentioned above. Definitely not all tho, we'll see how to improve this. More info also about the use of :child_key, :parent_key, and :model options to associations. And any other options if I'm missing them, its hard to find them :) I just added some docs on declaring self referential many to many relationships. You can find some information in :child_key and :parent_keythere, but I absolutely agree that this needs an own, more prominent place. http://datamapper.org/docs/associations As far as I can tell, there's no way to create something from a belongs_to or a has 1 reference. You have to just do .new and pass in :model = oldmodel? You can just assign a new instance of the related object to any #belongs_to or #has(1,...) relationship. The API tries to express the fact that there's really only *one* object at the end of that relationship, therefore it makes sense to treat it (almost) just like any normal property. Calling #create (to me) implies that either you're adding to a collection (as is the case for SomeModel.create and person.tasks.create(...)) or you're doing some kind of factory method (close to what #new does). Is create_and_destroy even linked to from anywhere? I hadn't seen it. It's linked fromhttp://datamapper.org/docs/as Creating, Saving, Updating and Destroying records The main 'why datamapper' page of the rdoc could use some organization and links to areas of the source tha tinclude more documentation (if any). http://rdoc.info/projects/datamapper/dm-core I agree, the Why DataMapper page needs work! Thanks for undertaking documentation updating! No worries, thx for your inputs! -- You received this message because you are subscribed to the Google Groups DataMapper group. To post to this group, send email to datamap...@googlegroups.com. To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/datamapper?hl=en. -- You received this message because you are subscribed to the Google Groups DataMapper group. To post to this group, send email to datamap...@googlegroups.com. To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.
[DataMapper] Re: Documentation patches wanted
Another suggestion would be more info on exactly what paranoid does in terms of the get methods and destroy methods (i.e. nothing to destroy, but adds checks against the pranoiddeleted boolean or datetime being null). More info about repositories and how to change them. Perhaps an example case of why so much work is done in the code to allow each resource to use a different repository and stuff like that. Seems strange after the ease of a class-level table_name setter in AR. -- You received this message because you are subscribed to the Google Groups DataMapper group. To post to this group, send email to datamap...@googlegroups.com. To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.
Re: [DataMapper] Re: Documentation patches wanted
Kevin, On Sun, Jul 18, 2010 at 07:50, Kevin inspir...@gmail.com wrote: It'd be nice if http://datamapper.org/docs/associations included mention of the name of the Resource table created, which keys/etc. Or how to auto_migrate! it to get it created.. As is, its rather hard to actually 'get started' with it. There is an actual 'Getting Started' section containing at least some of the information you mentioned above. Definitely not all tho, we'll see how to improve this. More info also about the use of :child_key, :parent_key, and :model options to associations. And any other options if I'm missing them, its hard to find them :) I just added some docs on declaring self referential many to many relationships. You can find some information in :child_key and :parent_key there, but I absolutely agree that this needs an own, more prominent place. http://datamapper.org/docs/associations As far as I can tell, there's no way to create something from a belongs_to or a has 1 reference. You have to just do .new and pass in :model = oldmodel? You can just assign a new instance of the related object to any #belongs_to or #has(1,...) relationship. The API tries to express the fact that there's really only *one* object at the end of that relationship, therefore it makes sense to treat it (almost) just like any normal property. Calling #create (to me) implies that either you're adding to a collection (as is the case for SomeModel.create and person.tasks.create(...)) or you're doing some kind of factory method (close to what #new does). Is create_and_destroy even linked to from anywhere? I hadn't seen it. It's linked from http://datamapper.org/docs/ as Creating, Saving, Updating and Destroying records The main 'why datamapper' page of the rdoc could use some organization and links to areas of the source tha tinclude more documentation (if any). http://rdoc.info/projects/datamapper/dm-core I agree, the Why DataMapper page needs work! Thanks for undertaking documentation updating! No worries, thx for your inputs! -- You received this message because you are subscribed to the Google Groups DataMapper group. To post to this group, send email to datamap...@googlegroups.com. To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en. -- You received this message because you are subscribed to the Google Groups DataMapper group. To post to this group, send email to datamap...@googlegroups.com. To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.
[DataMapper] Re: Documentation patches wanted
Nice work :) I should probably split it to a new topic, but about the belongs_to, in my case sometimes users have an extra userdata table with a bunch of optional things. So I want to basically do something like :@user.udata.find_or_create (which is how it would work in AR), but in DM it calls 'find_or_create' on the result of calling the relationship, rather than the relationship itself. I guess I'm stuck with something like @user.udata ||= Udata.new :user = @user ? A few more that would have been handy for me in the docs: checking for a property named something: properties.named?(:title) get vs get! vs first to query by primary key. I'm sure its mentioned somewhere but it was a bit 'gotcha' switching from AR. auto_migrate only works with innodb (which seems kinda dumb to me, as it should be pretty easy to change/leave off the 'engine' part as an option). That said, everyone should switch to innodb probably (especially for tests/transaction rollback), so maybe this is a good thing. Perhaps a 'switching from ActiveRecord' page would be useful, since I'm sure a lot of our new users will start with their preconceptions. Something I'm struggling with now is how the rails console deals with DataMapper.finalize/etc. It seems to work I think, you just have to call DataMapper.finalize once yourself. Then it auto-tries to redo it each time you reload!. Sometimes I get stuck with an error in a property name or something that doesn't go away at a reload! and have to restart the console (which sucks since as my other thread stated, it takes 10+ seconds). I'd be curious to hear how other people test things in DM to make sure they're working as expected. I've been running with a little 'testing.rb' script that loads all the dm stuff a few classes at the top, then I block out the bottom with __END__ and change what I'm testing in it. Then I can just run it from my editor. Its a bit slower going than being able to mess with state/etc as from a console though. Good morning! -Kevin -- You received this message because you are subscribed to the Google Groups DataMapper group. To post to this group, send email to datamap...@googlegroups.com. To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.