Hi, I plan to use ActiveRecord in a non RubyOnRails application (just
pure
Ruby app). How easy is it? is just loading the library?
It’s pretty much easy as pie. 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 1:30 PM, Iñaki Baz C. [email protected] 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?
Very easy. I wrote a long article about it a while back:
http://www.oreillynet.com/pub/a/ruby/2007/06/21/how-to-build-simple-console-apps-with-ruby-and-activerecord.html
But you’ll only need bits and pieces of it to get rolling.
-greg
El Lunes, 11 de Agosto de 2008, Iñaki Baz C. 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?
Thanks to all, it really seems easy
Iñaki Baz C. 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?
really easy. just go ahead.
On Aug 11, 1:30 pm, Iñaki Baz C. [email protected] 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 C.
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