I have a question regarding the compatbility of Rails and generic ActiveRecord. I am running Rails 2.0.2 on a Linux box. My ruby version is 1.8.6. I need to read from/write to some tables in the same rails production databases FROM OUTSIDE OF RAILS ENVIRONMENT. According to the following article, there are at least three ways to do this is Ruby: 1. Database driver; 2. DBI; 3. ActiveRecord. http://www.troubleshooters.com/codecorn/ruby/database/index.htm Of course the 3rd method (using the ActiveRecord) seems the most natural one given the grammar is the same as in Rails. My question is as follows. As we know, ActiveRecord is part of Rails. If I use the 3rd method to access the database, will that actually cause any problems to Rails, because I am using the same ActiveRecord in two places? Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 2/19/08, newbie <tao.wang.usa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> As we know, ActiveRecord is part of Rails. If I use the 3rd method to > access the database, will that actually cause any problems to Rails, > because I am using the same ActiveRecord in two places?No. -- Greg Donald http://destiney.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 -~----------~----~----~----~------~----~------~--~---
No, it won''t cause any problems. Rails is really a gem (hence the common gem install rails --include-dependencies) and ARec is just one of its gem dependencies. Since it''s on your system as a gem you can use it in any Ruby project. You won''t have the framework to issue the correct top-level include, but I''m sure you''ll get that worked out! On Feb 19, 5:57 pm, newbie <tao.wang....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a question regarding the compatbility of Rails and generic > ActiveRecord. > > I am running Rails 2.0.2 on a Linux box. My ruby version is 1.8.6. > > I need to read from/write to some tables in the same rails production > databases FROM OUTSIDE OF RAILS ENVIRONMENT. According to the > following article, there are at least three ways to do this is Ruby: > 1. Database driver; 2. DBI; 3. ActiveRecord. > > http://www.troubleshooters.com/codecorn/ruby/database/index.htm > > Of course the 3rd method (using the ActiveRecord) seems the most > natural one given the grammar is the same as in Rails. My question is > as follows. > > As we know, ActiveRecord is part of Rails. If I use the 3rd method to > access the database, will that actually cause any problems to Rails, > because I am using the same ActiveRecord in two places? > > Thanks!--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Got it! Thanks a lot! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---