Forum: Ruby on Rails model modules

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
John S. (Guest)
on 2006-04-22 00:06
(Received via mailing list)
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
(805) 893-6307
This topic is locked and can not be replied to.