RE: Newbie Question about Custom Classes

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
[email protected]

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