Using STI path with same controller
- by TenJack
I am using STI and am wondering, do I have to have a separate controller for each model? I have a situation where I only use the create and edit actions for one model in the STI relationship, but I get an 'undefined method' error if I try to do a form for. More specifically, I have two models that inherit from List:
class RegularList < List
class OtherList < List
and I have a lists controller that handles these actions, but I only create new models with RegularList using forms. i.e. the only situation where I use a form_for to create a new List object is with RegularList. What I would like to do is something like:
class ListsController < ApplicationController
def new
@list = RegularList.new
end
otherwise the route for creating a new list looks like regular_list/new but I would like it to just be list/new. Thoughts?