Last active
December 20, 2015 15:29
-
-
Save ruseel/6154373 to your computer and use it in GitHub Desktop.
jruby - ActiveRescord Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'bundler/setup' | |
| require 'active_record' | |
| require 'activerecord-jdbc-adapter' if defined? JRUBY_VERSION | |
| ActiveRecord::Base.establish_connection( | |
| :adapter => 'jdbc', | |
| :driver => 'com.microsoft.sqlserver.jdbc.SQLServerDriver', | |
| :url => 'jdbc:sqlserver://127.0.0.1:6231;DatabaseName=test', | |
| :username => 'username', | |
| :password => 'some_password' | |
| ) | |
| class Students < ActiveRecord::Base | |
| end | |
| p Students.find(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source 'https://rubygems.org' | |
| gem 'activerecord', '<= 3.2' | |
| gem 'activerecord-jdbcmssql-adapter', :platform => :jruby |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment