I have a attachment model and controller for al my images on the site. 

The relations are (polymorphic): 

```
class House
  has_many :attachments, :as => :attachable
end

class Apartment
  has_many :attachments, :as => :attachable
end

```

The attachment controller looks like this to store the right variables. 

```
class AttachmentController
  @appartment = Appartment.find(params[:apartment_id])
  @attachments = @appartment.attachments
end

```

this works on the apartment page/path. (apartment/1/assets) But on the house page (house/1/assets) I got the error message "Couldn't find Appartment without an ID"

How can I deal with this/best approach ? Conditions in the controller?