Michael Rigart wrote:
> Hi,
> 
> this might be a stupid question, but is there like a naming convention
> for base models? Lets say you develop an application where custom work
> is possible. So you create a core for your application.
> 
> But for the custom development, you don't want to touch your core code,
> you want to override / extend it.
> 
> How do you achieve this? Is it like possible to name your models /
> controllers in a certain way? And how do you override / extend your base
> code?
> 
> I was thing in a way like:
> 
> UsersBase < ActiveRecord::Base => (base model for users)
>   -> Users < UsersBase => custom stuff (like extra fields)
> 
> UsersBaseController < ApplicationController => (base controller
>   -> UsersController < UsersBaseController => custom actions / overriden
> actions
> 
> This could work right? 

Yes.  But it might be better to use namespaces (User::Base and so on). 
Also remember that Rails model names should be singular.

You might want to investigate the use of abstract_class.

> But what in the case that their isn't any custom
> work? Then I would still need to create those empty models /
> controllers, becouse otherwise I would have diffrent url's.

Wrong.  You could use routing to take care of that.

> 
> Also, I was thinking to convert my base code into plugins. But is still
> something I have to research on how to do that, and how to extend /
> override the plugin code.
> 
> So I whas hoping someone could give me some good advice here.
> Thank you in advance.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to