VoodooChild92
VoodooChild92

Reputation: 2053

Routes and controller actions for an inherited class in rails

I have been writing my code on top of fat_free_crm which is a popular open source rails crm.

You can check it out here: https://github.com/fatfreecrm/fat_free_crm

I've inherited the model "Lead" and created a new inherited class called "SellerLead". Now, although the inherited class "SellerLead" is quite different from "Lead" class at model-level, they're quite similar at the controller levels i.e. whatever controller actions happen with "Lead" also apply to "SellerLead".

Now, when I try to edit/update/create new "SellerLead" object, it's looking for views in the folder "seller_leads/".

How do I make it look into "leads" folder even for a SellerLead object?

Upvotes: 0

Views: 255

Answers (2)

dipak gupta
dipak gupta

Reputation: 366

You can handle this in routing level. something like this:

resource :seller_leads, :controller => "leads"

Hope it is helpful for you.

Upvotes: 3

steve klein
steve klein

Reputation: 2639

You can explicitly render a custom view like so:

render "leads/show"

See section 2.2.3 of this Rails guide for more detail.

Upvotes: 0

Related Questions