Guest User

Untitled

a guest
Apr 30th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. require 'rubygems'
  2. require 'active_record'
  3.  
  4. ActiveRecord::Base.establish_connection(
  5. :adapter=> "jdbcmysql",
  6. :host => "localhost",
  7. :database=> "testapp",
  8. :username => "root",
  9. :password => ""
  10. )
  11.  
  12. class Rubyist < ActiveRecord::Base
  13. end
  14.  
  15. Rubyist.create(:name => 'Mitali Talim', :city => "Nashville, Tenessee")
  16. Rubyist.create(:name => 'Sunil Kelkar', :city => "Pune, India")
  17. Rubyist.create(:name => 'Adam Smith', :city => "San Fransisco, USA")
  18.  
  19. participant = Rubyist.find(:first)
  20. puts %{#{participant.name} stays in #{participant.city}}
  21.  
  22. Rubyist.find(:first).destroy
Add Comment
Please, Sign In to add comment