From: shawn bright Date: 2008-08-19T12:50:02+09:00 Subject: Re: sharing classes in rails and with other ruby scripts ------=_Part_44510_30221516.1219118005714 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks for this, I am using these models in apps that are not rails apps andy yes, It is pretty easy to do. I had some advice in the rails irc where someone recommended the ActiveResource way to go. However, after having read some on it, i don't think i can employ it here because it is pretty new and my rails version is 1.2.4 If i upgrade to rails 2, i run the risk of breaking my site (which is pretty large now) . Thanks for your attention on this Joshua, and if you know of a good trick that might work for me I would welcome any suggestions. Actually, it is only about 4 of the models that i want to share, but if i do 4, i may as well do them all. thanks again sk On Mon, Aug 18, 2008 at 8:14 PM, Joshua Ballanco wrote: > Shawn Bright wrote: > > Is there a way i can share this class ( model ) with several different > > websites running rails and also use it in my cron jobs, etc.. > > Well, ActiveRecord is available as it's own gem, and a class which > inherits from ActiveRecord does not need the full Rails framework to be > useful (a bit of Googling should give you examples of ActiveRecord used > outside of Rails...or you could just look at Camping: > http://code.whytheluckystiff.net/camping). If you wanted, you could keep > your model collection in one place (say, /usr/lib/mycompanysstuff), and > then you would just need to modify your environment to require the model > classes from there... > > ...however! If you are constantly accessing the models from Rails apps, > it would probably be worth your while to look into setting up a > dedicated Rails app to serve up the model data and then access the data > from your other apps using ActiveResource. That solution has the > advantage of being scalable as well (...and ActiveResource is just dang > cool!). > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_44510_30221516.1219118005714--