I have 3 models:
class Request < ActiveRecord::Base
acts_as_paranoid
belongs_to :offer
end
class Offer < ActiveRecord::Base
belongs_to :cruise, inverse_of: :offers
has_many :requests
end
class Travel < ActiveRecord::Base
acts_as_paranoid
has_many :offers, inverse_of: :travel
end
Usually I can access Travel
object through chain like this: request.offer.travel
.
However, if Travel
object I need is deleted with paranoia
- I can not access it through such objects chain.
Travel.with_deleted.find(some_id_of_deleted_travel)
works perfectly, but request.offers.travel.with_deleted
, that the same object, throws me undefined method 'with_deleted' for nil:NilClass
.
How can I access deleted object through relation?