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.
66c680f88e8c379fe408d32299dfb4e6?d=identicon&s=25 jjones (Guest)
on 2005-11-25 04: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.
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 james.adam (Guest)
on 2005-11-25 09: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
4bd34a2216dc8bdbf1f017f64e4d59e8?d=identicon&s=25 kyle (Guest)
on 2005-11-25 10:38
(Received via mailing list)
The lib folder is also viable.  Remember to include it in your
environment.
01ec89b682c7ae076d25c39a70def227?d=identicon&s=25 Rick (Guest)
on 2005-11-25 17:32
Is it possible to create a directory somewhere outside of the project
and include that directory in the path?
981b75f949c81efad3bc4b3c4ea88332?d=identicon&s=25 Scott Becker (Guest)
on 2005-11-25 20: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.