Module: DataMapper::Resource

Included in:
Mack::DataMapper::Session, Mack::Testing::DmTestTransactionWrapper
Defined in:
lib/mack-data_mapper/paginator.rb,
lib/mack-data_mapper/resource.rb

Overview

:nodoc:

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#to_paramObject

Returns the key of the DataMapper::Resource object when passed into a url helper

Example:

class User
  include DataMapper::Resource
  property :name, String, :key => true
end
users_show_url(User.new(:username => "markbates")) # => /users/markbates


12
13
14
# File 'lib/mack-data_mapper/resource.rb', line 12

def to_param
  self.key
end