RubyCocoa and ActiveRecord?

T

Tim Perrett

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 Perrett
 
A

Andreas Schwarz

Tim said:
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.
 
T

Tim Perrett

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top