Brandon Casci
2006-Aug-23 19:32 UTC
[Rails] 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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Ezra Zygmuntowicz
2006-Aug-23 22:28 UTC
[Rails] Re: Re-Use of Rails generated ActiveRecord classes
On Aug 23, 2006, at 12:32 PM, Brandon Casci wrote:> > 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. >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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Brandon Casci
2006-Aug-23 22:57 UTC
[Rails] Re: Re-Use of Rails generated ActiveRecord classes
Cool. Thanks for the link. I kept searching for something like Using Models outside Rails and I wasn''t getting any hits. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---