Module | DataMapper::Model |
In: |
lib/dm-core/adapters/data_objects_adapter.rb
lib/dm-core/model.rb |
TODO: move to dm-ar-finders
Extends the model with this module after DataMapper::Resource has been included. This is a useful way to extend DataMapper::Model while still retaining a self.extended method. @param [Module] extensions the module that is to be extend the model after after DataMapper::Model @return [TrueClass, FalseClass] whether or not the inclusions have been successfully appended to the list
-
@api public TODO: Move this do DataMapper::Model when DataMapper::Model is created
Copy a set of records from one repository to another.
@param [String] source
The name of the Repository the resources should be copied _from_
@param [String] destination
The name of the Repository the resources should be copied _to_
@param [Hash] query
The conditions with which to find the records to copy. These conditions are merged with Model.query
@return [DataMapper::Collection]
A Collection of the Resource instances created in the operation
@api public
The field naming conventions for this resource across all repositories.
@return <String> The naming convention for the given repository
Find instances by manually providing SQL
@param sql<String> an SQL query to execute @param <Array> an Array containing a String (being the SQL query to
execute) and the parameters to the query. example: ["SELECT name FROM users WHERE id = ?", id]
@param query<DataMapper::Query> a prepared Query to execute. @param opts<Hash> an options hash.
:repository<Symbol> the name of the repository to execute the query in. Defaults to self.default_repository_name. :reload<Boolean> whether to reload any instances found that already exist in the identity map. Defaults to false. :properties<Array> the Properties of the instance that the query loads. Must contain DataMapper::Properties. Defaults to self.properties.
@note
A String, Array or Query is required.
@return <Collection> the instance matched by the query.
@example
MyClass.find_by_sql(["SELECT id FROM my_classes WHERE county = ?", selected_county], :properties => MyClass.property[:id], :repository => :county_repo)
- @api public
Get the repository with a given name, or the default one for the current context, or the default one for this class. @param name<Symbol> the name of the repository wanted @param block<Block> block to execute with the fetched repository as parameter @return <Object, DataMapper::Respository> whatever the block returns, if given a block, otherwise the requested repository.
-
@api public
the name of the storage recepticle for this resource. IE. table name, for database stores
@return <String> the storage name (IE table name, for database stores) associated with this resource in the given repository
the names of the storage recepticles for this resource across all repositories
@return <Hash(Symbol => String)> All available names of storage recepticles