Forum: Ruby on Rails RE: Newbie Question about Custom Classes

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.
Hogan, Brian P. (Guest)
on 2006-03-20 17:53
(Received via mailing list)
If you've not read the Agile Web D. book, you really should.

YOu can define custom classes anywhere, really... *lib, vendor, etc.
However, what you have is definitely a model class... So create it in
the models folder.


 class Article

    # class methods
    def self.find()
      # load a new article instance from the xml file based on the
conditions in the finder.
      # maybe you have to return an array of these article objects
because you might find
      # more than one.

    def self.find_by_title


    # instance methods
    def title
      ' return title


Then you can access it like any other model.

Please share what you create... It could be useful to others! Good luck!

Brian H.
Web D.
Learning & Technology Services
Schofield 3-B
University of Wisconsin-Eau Claire
715 836 3585
This topic is locked and can not be replied to.