Re-Use of Rails generated ActiveRecord classes

Hello. I’m doing a litle research about Rails. I installed Ruby and
Rails, chose an IDE, read a few tutorials and bought a book. I’m just
trying to get the feel of it right now.

I might want to build a billing system with RoR. I understand RoR
generates ActiveRecord classes for you, called models, and you can
include business logic in the models. I would problably add methods to
these models, and those methods will contain business logic…things
like:

Customer.UpdateBalance
Customer.Cancel
and so on…

Can these Models be used as-is in a Ruby script outside of Rails? My
goal would be to not repeat the business logic by using the RoR
generated models in any kind of maintenance script that would run on a
scheduled basis. That would include scripts doing things like:

-emailing past due notices
-creating invoices
-processing credit card payments
…and more

How do people normally these situations this with RoR applications?

Thanks.

Cool. Thanks for the link.

I kept searching for something like Using Models outside Rails and I
wasn’t getting any hits.

On Aug 23, 2006, at 12:32 PM, Brandon C. wrote:

-creating invoices
-processing credit card payments
…and more

How do people normally these situations this with RoR applications?

Thanks.

Hey Brandon-

Welcome to rails ;) Yeah you can use your ActiveRecord models

outside of rails pretty easily. So you can write your business logic
in the models and not have to duplicate it elsewhere.

http://wiki.rubyonrails.com/rails/pages/HowToUseActiveRecordOutsideRails

Cheers-
-Ezra