How easy is using ActiveRecord in a non RoR application?

Hi, I plan to use ActiveRecord in a non RubyOnRails application (just pure
Ruby app). How easy is it? is just loading the library?

···

--
Iñaki Baz Castillo

It's pretty much easy as pie. :slight_smile: It's along the lines of

require 'rubygems'
require 'active_record'

class Model < ActiveRecord::Base
  has_many :other_models
  belongs_to :parent_model

  ...

end

There's other database modeling packages out there as well that you could
consider too -- Sequel, DataMapper, etc...

···

--
Bryan

On Mon, Aug 11, 2008 at 11:30 AM, Iñaki Baz Castillo <ibc@aliax.net> wrote:

Hi, I plan to use ActiveRecord in a non RubyOnRails application (just pure
Ruby app). How easy is it? is just loading the library?

--
Iñaki Baz Castillo

Very easy. I wrote a long article about it a while back:

But you'll only need bits and pieces of it to get rolling.

-greg

···

On Mon, Aug 11, 2008 at 1:30 PM, Iñaki Baz Castillo <ibc@aliax.net> wrote:

Hi, I plan to use ActiveRecord in a non RubyOnRails application (just pure
Ruby app). How easy is it? is just loading the library?

--
Technical Blaag at: http://blog.majesticseacreature.com | Non-tech
stuff at: http://metametta.blogspot.com

easy. i use activerecord in my db operations as i dont have to break
my head for sql operations. u just create a model class and requrie it
and use it just as u would do in rails.

require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:host => "localhost",
:database => "mydb",
:username => "root"
)
class Tag < ActiveRecord::Base
    set_table_name "tags"
    has_and_belongs_to_many :trades

end

···

On Aug 11, 1:30 pm, Iñaki Baz Castillo <i...@aliax.net> wrote:

Hi, I plan to use ActiveRecord in a non RubyOnRails application (just pure
Ruby app). How easy is it? is just loading the library?

--
Iñaki Baz Castillo

Thanks to all, it really seems easy :slight_smile:

···

El Lunes, 11 de Agosto de 2008, Iñaki Baz Castillo escribió:

Hi, I plan to use ActiveRecord in a non RubyOnRails application (just pure
Ruby app). How easy is it? is just loading the library?

--
Iñaki Baz Castillo