Skip to content

Instantly share code, notes, and snippets.

@praveend
Created February 2, 2010 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save praveend/292592 to your computer and use it in GitHub Desktop.
Save praveend/292592 to your computer and use it in GitHub Desktop.
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter=>"ibm_db",
:database=>"arunit",
:username=>"user",
:password=>"secret",
:parameterized=>false
)
require 'post' # require the post.rb model file from activereocrd/test/models
require 'author' # require the author.rb model file from activereocrd/test/models
puts Post.find(:first).id # Find the first record and print it's id
author = Author.find(1)
author.posts_sorted_by_id_limited.update_all([ "body = ?", "bulk update12" ])
puts Post.find(1).body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment