When having a polymorphic association in Rails model, you want to: generate URLfind the parent model in the controllerSee below our model structure. Let's answer those questions the Rails way. class Company < ActiveRecord::Base has_many :images end class Product < ActiveRecord::Base