I have some simple ruby classes that I want to use with rails (they are classes for things like points, lines, rectangles, etc.). How can I use them with a rails controller or an active record model?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The convention is to put them in
your-app/lib/. You can have Rails automatically load them by configuring it to do so inconfig/application.rb. Edit the default to look something like this:Where your class definition files are in
your-app/lib/shapes.Note: This is for Rails 3. Rails 2.x automatically loads files from lib.