Rails: Issuing direct query to database

June 19, 2006

You can issue direct query to database by:

result = ActiveRecord::Base.connection.execute("SELECT * from tablename")

and fetch hash:

a=result.fetch_hash

Entry Filed under: RubyonRails, rails. .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Important Notice…

I have moved this blog to http://webonrails.com . I will continue posting at http://webonrails.com, not on http://webonrails.wordpress.com.

Kindly update your book marks to http://webonrails.com

and http://webonrails.com/feed .

I am really very sorry for inconvenience.

Comming Soon….

Domain for Sale

TheRailsHosting.com


(Contact me)

c

Top Posts

Recent Posts

Recent Comments

jyoti on Ruby On Rails India
extessBob on My new HP Pavillion DV2117…
clexmases on My new HP Pavillion DV2117…
i can haz ajax? on Uploading files using AJA…
Peter on Plugin: NumbersToWords

rails

Ruby

RubyonRails

Calender

June 2006
M T W T F S S
« Apr   Jul »
 1234
567891011
12131415161718
19202122232425
2627282930  

Archives

Subscribe

  • Add to Google
  • Subscribe in NewsGator Online
  • Subscribe with Bloglines
  • WebOnRails on feedburner
  • technorati

del.icio.us

Feeds

Flickr Photos

iris

Icing on the Cake

* 7 EXPLORE

More Photos

Visitor’s Location

Spam Blocked

Blog Stats