>
> I was able to make a db.rb which does a require 'active_record' and
> establishes a connection.
>
> I then have a Test class that inherits from ActiveRecord::Base.
>
> I wasn't really sure the best way forward from there.
>
> Because I wanted static content available and saw a post about using
> Rack::Static I just setup my module with a Test.find(1) query to pull a
> record from my DB
>
> module Test
>   $test = Test.find(1)
>   use Rack::Static, :urls => ['/static']
> end
>
> Now in my views I have a line like:
>
> p "Pg query: #{$test.text}"
>
>
> It prints data from my db/
>
>
> your db is sqlite or a static file db ? you might want to try kirbybase
> for really simple ruby based db but perhaps you have something else in mind
> :)
>
>
Guess I should have made that more clear :)

I'm using a PostgreSQL DB, one of the things I wanted to play with is a
webmail client and since I have my postfix/dovecot setup against
PostgreSQL, I wanted to start off using AR against it.

So far I can query the DB ok, just wasn't sure if I was doing a right/smart
way.

>
> I'm just not sure if using a global is the right way to go about it.
>
> I tried a instance variable (@test.text) but that didn't seem to work.
> Still getting a handle on ruby OO.
>
>
> Will leave it to more experienced campers :)
>
>
Cool, hopefully someone might know, and if not, no biggie, I still can wade
forward using any hacks.

The code I'm writing is protected by IP ACL's and when finally exposed to
the inet I will be using client side SSL certs, why I'm using Apache
because I already know how to set that up.

All this because I have yet to find a webmail client that I like and
works/looks ok on my mobiles, I guess when in doubt, code it yourself.
_______________________________________________
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to