# RubyCocoa and ActiveRecord?

**URL:** <https://www.ruby-forum.com/t/rubycocoa-and-activerecord/89857>\
**Category:** Ruby\
**Created:** [March 23, 2007, 11:38am UTC](https://www.ruby-forum.com/t/rubycocoa-and-activerecord/89857 "2007-03-23T11:38:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [March 23, 2007, 11:38am UTC](https://www.ruby-forum.com/t/rubycocoa-and-activerecord/89857/1 "2007-03-23T11:38:10Z")

</div>

Hey all

I have been contemplating if it is possible to use ActiveRecord in a  
RubyCocoa application? Has anyone tried it? is it even possible?

All the best

Tim P.

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [March 23, 2007, 1:49pm UTC](https://www.ruby-forum.com/t/rubycocoa-and-activerecord/89857/2 "2007-03-23T13:49:12Z")

</div>

Tim P. wrote:

> I have been contemplating if it is possible to use ActiveRecord in a  
> RubyCocoa application? Has anyone tried it? is it even possible?

Of course it’s possible, ActiveRecord ist just a normal Ruby library.  
You could even try to write an ActiveRecord database adapter for  
CoreData.

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [March 23, 2007, 2:11pm UTC](https://www.ruby-forum.com/t/rubycocoa-and-activerecord/89857/3 "2007-03-23T14:11:39Z")

</div>

Sounds sweet.

I see what you mean, i managed to get in there by doing a simple  
require! should have thought of that.

One thing im not quite sure about however, is how would i then handle  
that connection within the application? I obviously create my connection  
with

ActiveRecord::Base.establish\_connection(  
:adapter =\> “mysql”,  
:host =\> “localhost”,  
:username =\> “myuser”,  
:password =\> “mypass”,  
:database =\> “somedatabase”  
)

For instance, in rails, how is it that we can then call  
SomeModel.find(:all) in our controller and it does not throw an error? I  
know its to do with the load path, but does the same apply here?

Does it create a persistant connection to the database for the lifetime  
of the application or do i need to call the connection from AR::Base  
when i need it?

Cheers

Tim

PS: sorry if this seems like dull questions im just getting into the  
RubyCocoa thing!

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [May 21, 2007, 7:07pm UTC](https://www.ruby-forum.com/t/rubycocoa-and-activerecord/89857/4 "2007-05-21T19:07:34Z")

</div>

Thanks Eloy, thats is a brilliant resource!

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [May 20, 2007, 2:28pm UTC](https://www.ruby-forum.com/t/rubycocoa-and-activerecord/89857/5 "2007-05-20T14:28:56Z")

</div>

Hey Tim,

Just wanted to point you to the new RubyCocoa Wiki, which has some info  
about the new ActiveRecord support in RubyCocoa.

[http://rubycocoa.sourceforge.net/Wikka/wikka.php?wakka=ActiveRecordSupport](http://rubycocoa.sourceforge.net/Wikka/wikka.php?wakka=ActiveRecordSupport)

Cheers,  
Eloy

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [May 21, 2007, 7:51pm UTC](https://www.ruby-forum.com/t/rubycocoa-and-activerecord/89857/6 "2007-05-21T19:51:41Z")

</div>

Tim P. wrote:

> Thanks Eloy, thats is a brilliant resource!

Please do send any feedback to the rubycocoa-talk mailinglist.  
[http://rubycocoa.sourceforge.net/Wikka/GettingSupport](http://rubycocoa.sourceforge.net/Wikka/GettingSupport)

Cheers,  
Eloy
