Hi all! I have a strange problem when i try to use polymorphic
associations in my app. I have a simple relations between my models:
class Item < ActiveRecord::Base
belongs_to :content, :polymorphic => true, :dependent => :destroy
class Page < ActiveRecord::Base
has_one :item, :as => :content, :dependent => :destroy
When i add a new Item everything works fine, all associations creates
and all looks great, but when i do like this
@item = Item.find(1)
or even when i try to do this
@page = Item.find(1)
I get “ActiveRecord::RecordNotFound: Couldn’t find Page without an ID”
Of course, page and item with id=1 are exist.
What i did wrong?