non-ActiveRecord models

Hi All,

I am wondering about few thing regarding the RoR models:

  • Is there any requirement for the models to be inherited from
    ActiveRecord?
  • Is it possible to have a model which is not ActiveRecord based?
  • How Rails will react if it finds such files under /app/models?

You help will be appreciated.

Thanks

  • Is there any requirement for the models to be inherited from
    ActiveRecord?

No.

  • Is it possible to have a model which is not ActiveRecord based?

Yes.

  • How Rails will react if it finds such files under /app/models?

Just fine. You obviously won’t get all the AR goodness, but otherwise
Rails doesn’t care. We have several that aren’t AR based and they work
just fine for what we want to do (interface with some CLI apps, etc.)

-philip

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs