Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 6c6d471ff1
Fetching contributors…

Cannot retrieve contributors at this time

85 lines (73 sloc) 4.292 kB
layout title body_id created_at
default
Documentation
docs
Fri Nov 30 15:29:01 +1030 2007

{{ page.title }}

API
The API for the current gem release.
Why DataMapper?
If you haven't read this yet, you should, right now!
Getting Started
A whirlwind tour of DM. This is the place to start if you haven't used the library before.
Common installation issues
Troubleshooting installation, with instructions for specific platforms.
Properties
Properties declared in your model map to the fields in the database.
Creating, Saving, Updating and Destroying Records
Obviously you're going to be doing a lot of this :)
Validations
Auto-validations, manual validations, contextual validations
Finding and Counting Records
There are lots of nice ways to find records.
Associations
Models can be associated to each other in various ways using the has keyword
Hooks
Hooks, AKA Callbacks, allow you to "advise other methods" by running methods before or after calling other methods.
Misc. Features
Paranoia, Timezone Handling, Single Table Inheritance, and Multiple Repositories.
Working with Legacy Schemas
Adapting data-store naming conventions to your own property names.
Common Pitfalls
Solutions and work-arounds to common problems.
More
Plugins galore for DataMapper.

Documentarians Wanted!

Want to help DataMapper, but don't know where to start? A great way to contribute is to help out in the documentation effort.

If you know of some interesting and useful functionality that isn't covered on datamapper.org, just go ahead and fork datamapper.github.com, send us a pull request, and we'll merge it as fast as we can. If you want to contribute more, we can give you commit access to the repository right after that.

If you find some undocumented piece of code inside dm-core or any of the other datamapper repositories, we would greatly appreciate it if you take the time to read and understand that code, fork the repository, add the necessary docs and send us a pull request. Again, we'll try to merge them as fast as we can.

Documentation Style

DataMapper uses the YARD standard for RDoc documentation. Here's a brief sample from the internals of DM-Core:

{% highlight ruby linenos %}

Setups up a connection to a data-store

@param [Symbol] name

a name for the context, defaults to :default

@param [Hash(Symbol => String), Addressable::URI, String] uri_or_options

connection information

@return [DataMapper::Adapters::AbstractAdapter]

the resulting setup adapter

@raise [ArgumentError] "+name+ must be a Symbol, but was..."

indicates that an invalid argument was passed for name[Symbol]

@raise [ArgumentError] "+uri_or_options+ must be a Hash, URI or String, but was..."

indicates that connection information could not be gleaned from

the given uri_or_options[Hash, Addressable::URI, String]

@api public

def self.setup(name, uri_or_options) raise ArgumentError, "+name+ must be a Symbol, but was #{name.class}", caller unless Symbol === name #... end {% endhighlight %}

For more information about the YARD documentation style, see the YARD Getting Started document.

  • [YARD]: Yet Another Ruby Documentation (tool)
Jump to Line
Something went wrong with that request. Please try again.