开发者

Invoking ruby classes outside of rails app structure

I have a question regarding how to call ruby classes that reside outside of rails app structure. I have few Ruby classes that are used/invoked from cron job periodically.

I would like to use the same ruby classes to be invoked from a rails controller after user creat开发者_JAVA技巧es a model object.

Is it possible to invoke code that resides outside of rails app directory without copying the ruby classes over. I am mostly concerned that both the classes will be out of sync soon if I have to copy them to rails app folder.

Ruby app reside in, /usr/local/railsapp1 . The ruby classes reside in /usr/local/other_task/

Any suggestions would be of great help.

thanks


You can. Just use in your config/environment.rb

   config.load_paths << "/usr/local/other_task/"

This will load whatever classes in that folder into your rails environment.

But the path is hard-coded in this case, so you have to be careful when deploying.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜