Model modules

I have a need to subclass models a lot and I thought modules would be
the way to go, but I am encountering nothing but trouble with them. I
seem to be getting stuck with storing an object in the session, but
on the next request it can no longer read the session data and
creates a new session. Any other time I use the model it works just
fine. I read “Agile Web D. With Rails” and it mentioned this
sort of thing, but it seems their example is too simple to apply to
my situation.

  1. I am not getting any errors saying “Objects where the class
    definition wasn’t available…” as mentioned in the book.
  2. The book says I must tell the controller which models to load, but
    how do you do that with a model in a module?
    I presume like this:
    class Activities::Programs::ApplyController < ApplicationController
    model ‘prod_record/pgm_update/client’

But without any feedback I cannot tell if I am doing it right. Can
anyone help? Can I get an example of a modularized model that I can
look at?


John S.
Computing Staff - Webmaster
Kavli Institute for Theoretical Physics
University of California, Santa Barbara
[email protected]
(805) 893-6307

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