
belongs_to :with_deleted => true
Reported by Dawid Marcin Grzesiak | April 20th, 2010 @ 08:12 AM
It would be very helpful to have :with_deleted option in associations definition, similar to ActiveRecord: http://svn.techno-weenie.net/projects/plugins/acts_as_paranoid/test...
require 'rubygems'
require 'datamapper'
DataMapper::Logger.new(STDOUT, :debug)
DataMapper.setup(:default, 'sqlite3::memory:')
class Company
include DataMapper::Resource
property :id, Serial
property :name, String
property :deleted, ParanoidBoolean
has n, :people
end
class Person
include DataMapper::Resource
property :id, Serial
property :name, String
belongs_to :company #, :with_deleted => true
end
DataMapper.auto_migrate!
repository.adapter.execute %{
INSERT INTO "companies" ("name", "deleted") VALUES ('wild company', 1)
}
repository.adapter.execute %{
INSERT INTO "people" ("name", "company_id") VALUES ('Dawid Marcin Grzesiak', 1)
}
raise 'I want my company!' unless Person.first.company
Comments and changes to this ticket
-
Dan Kubb (dkubb) May 21st, 2010 @ 11:51 PM
- State changed from new to suggestion
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »