Forum: Ruby on Rails model modules

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
858392acd1398aa6071fb1d44cc33842?d=identicon&s=25 John Smilanick (Guest)
on 2006-04-21 22: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 Development 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

--
John Smilanick
Computing Staff - Webmaster
Kavli Institute for Theoretical Physics
University of California, Santa Barbara
jsmilani@kitp.ucsb.edu
(805) 893-6307
This topic is locked and can not be replied to.