Guest User

Untitled

a guest
May 19th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. require 'active_record'
  2.  
  3. ActiveRecord::Base.establish_connection(
  4. :adapter=>"ibm_db",
  5. :database=>"arunit",
  6. :username=>"user",
  7. :password=>"secret",
  8. :parameterized=>false
  9. )
  10.  
  11. require 'post' # require the post.rb model file from activereocrd/test/models
  12. require 'author' # require the author.rb model file from activereocrd/test/models
  13.  
  14. puts Post.find(:first).id # Find the first record and print it's id
  15.  
  16. author = Author.find(1)
  17. author.posts_sorted_by_id_limited.update_all([ "body = ?", "bulk update12" ])
  18.  
  19. puts Post.find(1).body
Add Comment
Please, Sign In to add comment