Load all *.jar files in RAILS_ROOT/lib

/ Published in: Ruby
Save to your folder(s)

Copy this code and paste it in your HTML
  1. # for JRuby, load JDBC adapter and all the .jar files in lib.
  2. if (RUBY_PLATFORM =~ /java/)
  3. require 'jdbc_adapter'
  4. Dir.foreach(File.join(RAILS_ROOT, 'lib')) do |file|
  5. if m = /([^\s]+)\.jar$/.match(file)
  6. require m[1]
  7. end
  8. end
  9. end

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.