# Problems with form\_for, STI, and polymorphic routing

**URL:** <https://www.ruby-forum.com/t/problems-with-form-for-sti-and-polymorphic-routing/137333>\
**Category:** Rails\
**Created:** [May 12, 2008, 5:04am UTC](https://www.ruby-forum.com/t/problems-with-form-for-sti-and-polymorphic-routing/137333 "2008-05-12T05:04:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![HSWade\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e19adc/32.png) [@HSWade\_M](https://www.ruby-forum.com/u/HSWade_M)\
**Post date:** [May 12, 2008, 5:04am UTC](https://www.ruby-forum.com/t/problems-with-form-for-sti-and-polymorphic-routing/137333/1 "2008-05-12T05:04:46Z")

</div>

I’m stumped on how to get past this. It’s Rails 2.0.2.

I have a class, Show. Using STI, I’m using that as a base class, and  
have DayShow and NightShow that inherit from it.

### 

class Show \< ActiveRecord::Base  
end

class DayShow \< Show  
end

### 

In my shows/edit.html.erb, I have:

\<% form\_for(@show) do |f| %\>

However, when I use it with a @show that has class DayShow, I get:

undefined method `day\_show\_path’ for #ActionView::Base:0x2382bb8

So it’s trying to use the STI class name, instead of the base class  
name, to generate the routes.

Digging around on Google, it seems that a few people have run into  
this, but I haven’t been able to find a solution. Can I use form\_for  
on an object that has STI in Rails 2.0, or do I need to build form  
tags by hand?

Thanks,  
Wade
