Hi, I have a simple rails application with a model. The data that needs to be entered in the database comes from an external application which I can parse using a standard ruby script. What would be the proper way to handle model/database interactions from an external ruby script? Should I use rake tasks instead? Thanks! JF --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Emmanuel Oga
2007-Jun-19 14:30 UTC
Re: Interact with the database from a simple ruby script
Jean-Francois wrote:> Hi, > > I have a simple rails application with a model. The data that needs to > be entered in the database comes from an external application which I > can parse using a standard ruby script. What would be the proper way > to handle model/database interactions from an external ruby script? > Should I use rake tasks instead? > > Thanks! > > JFRead this: http://www.railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial and maybe this: http://errtheblog.com/post/33 The go ahead and write your rake tasks. :) Emmanuel Oga -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
puts everything togheter, something like: require ''rubygems'' require_gem ''activerecord'' ActiveRecord::Base.establish_connection({ :adapter => ''mysql'', :database => ''mydb'', :username => ''user'', :password => ''password'' }) class MyTable < ActiveRecord::Base end ...your ruby script that parse here... 2007/6/19, Jean-Francois <jf.cron0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > Hi, > > I have a simple rails application with a model. The data that needs to > be entered in the database comes from an external application which I > can parse using a standard ruby script. What would be the proper way > to handle model/database interactions from an external ruby script? > Should I use rake tasks instead? > > Thanks! > > JF > > > > >--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
lancecarlson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jun-20 14:29 UTC
Re: Interact with the database from a simple ruby script
Also check out http://benlog.org/2007/6/18/stepping-off-the-rails-with-rack On Jun 19, 10:32 am, claudio <cinra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> puts everything togheter, something like: > > require ''rubygems'' > require_gem ''activerecord'' > > ActiveRecord::Base.establish_connection({ > :adapter => ''mysql'', > :database => ''mydb'', > :username => ''user'', > :password => ''password'' > > }) > > class MyTable < ActiveRecord::Base > end > > ...your ruby script that parse here... > > 2007/6/19, Jean-Francois <jf.cr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > > > Hi, > > > I have a simple rails application with a model. The data that needs to > > be entered in the database comes from an external application which I > > can parse using a standard ruby script. What would be the proper way > > to handle model/database interactions from an external ruby script? > > Should I use rake tasks instead? > > > Thanks! > > > JF--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---