Forum: Ruby on Rails Best location for generic classes?

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.
jjones (Guest)
on 2005-11-25 05:20
(Received via mailing list)
Say for instance, if I have a class that computes PI, where would the
best place to locate this class so that its accessible by the
controllers and helpers?  What if I wanted to make this generic class
accessible to multiple RoR projects?

TIA.
james.adam (Guest)
on 2005-11-25 10:30
(Received via mailing list)
Make it a plugin if it's mainly for use in Rails projects... if it's
generally applicable to any Ruby project, you might want to make it a
Gem.

http://wiki.rubyonrails.com/rails/pages/Plugins
http://docs.rubygems.org/

- james
kyle (Guest)
on 2005-11-25 11:38
(Received via mailing list)
The lib folder is also viable.  Remember to include it in your
environment.
Rick (Guest)
on 2005-11-25 18:32
Is it possible to create a directory somewhere outside of the project
and include that directory in the path?
Scott B. (Guest)
on 2005-11-25 21:23
Rick wrote:
> Is it possible to create a directory somewhere outside of the project
> and include that directory in the path?

You can sym link it:

ls -s reusable_stuff/your_plugin
your_rails_app/vendor/plugins/your_plugin

 - Scott
This topic is locked and can not be replied to.