Re: Modules in rails? ( controllers or models?)




On Dec 2, 2007, at 6:40 PM, malugu satyajit wrote:

Hello,

I have an rails application that has almost similar function for three
classes. So I am thinking to create a parent class and then the sub
classes
inherit from it. But rails already inherits from ActiveRecord
(models) or
ApplicationController(controller).

So how can I inherit from others classes. My my ruby knowledge it
is modules
and then you mixin the module in your class.

Now my question, where you write the module in rails is it in
controller or
model? Can some one provide me links or guidance.


You can create a parent class that inherits from ActiveRecord or
ApplicationController.
Then, your subclasses can inherit from the parent class.

This may or may not work, and this is a question for the rails list


_______________________________|
- Ari
I just bought another case of RockStar. Expect architectural changes.



.



Relevant Pages

  • Re: Modules in rails? ( controllers or models?)
    ... I have an rails application that has almost similar function for three ... So I am thinking to create a parent class and then the sub ... But rails already inherits from ActiveRecord ... So how can I inherit from others classes. ...
    (comp.lang.ruby)
  • Re: Modules in rails? ( controllers or models?)
    ... I have an rails application that has almost similar function for three ... So I am thinking to create a parent class and then the sub classes ... So how can I inherit from others classes. ... necessary mixin themselves, ...
    (comp.lang.ruby)
  • Modules in rails? ( controllers or models?)
    ... parts of this message were removed by the gateway to make it a legal Usenet post. ... I have an rails application that has almost similar function for three ... So I am thinking to create a parent class and then the sub classes ... So how can I inherit from others classes. ...
    (comp.lang.ruby)
  • Re: Difficult Inheritance Problem
    ... The descendents of this class each define their own difference ... class Page < DataObject ... I would now like to inherit from the Page class but use its ... Intro to Ruby on Rails January 12-15 Fort Lauderdale, ...
    (comp.lang.ruby)
  • Re: Include module and class inheritance? which one to choose?
    ... Learn Ruby on Rails! ... Check out the FREE VIDS ... but we can achieve the same thing by inherit a class which will ... all the methods also.I know we can mixin multiple classes but only ...
    (comp.lang.ruby)