jruby

How to get the path of the jruby/warbler jar file

我只是一个虾纸丫 提交于 2019-12-11 20:12:54
问题 I'm building an application using JRuby and Warbler to package it. My problem is that I want to get the path of the jar file that is currently running, without writing java... 回答1: Does RbConfig::CONFIG["bindir"] have what you want? $ java -cp Development/src/jruby/lib/jruby-complete.jar org.jruby.Main -e 'require "rbconfig"; p RbConfig::CONFIG["bindir"]' "file:/Users/asari/Development/src/jruby/lib/jruby-complete.jar!/META-INF/jruby.home/bin" 来源: https://stackoverflow.com/questions/8743854

How do I modify a global variable in my Rails script from JavaScript?

核能气质少年 提交于 2019-12-11 19:21:03
问题 I have the following variable defined in my Rails controller: $PATH In JavaScript I would like to change the value of this variable: <script> $("#resetDefaults").click(function(){ $PATH = '3'; //try 1 <%= $PATH %> = '3'; // try 2 }); </script> I have tried both of the above statements and can't figure out how to do it. 回答1: A global variable is only global in the Ruby code that is executed on the server . You're running JavaScript code in the browser. That code has no direct access to

Function 'xsltParseStylesheetDoc' not found in [libxml2.so]

白昼怎懂夜的黑 提交于 2019-12-11 17:36:00
问题 This error comes up in Redhat Enterprise Linux Server 5.4 - 64 bit. Linux rhl-64-tibbr5 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux There is also this error in the stack trace. uninitialized constant Nokogiri::VERSION_INFO More version details: jruby-1.4.0RC1 ruby/gems/1.8/gems/activesupport-2.3.4 Any idea? 回答1: After wasting a few hours on this issue, we realized we didn't need nokogiri in our application. So we got it rid of it and these errors

Gem Load Error is: undefined method `type_cast_from_database' for class `ArJdbc::MSSQL::UUIDType'

荒凉一梦 提交于 2019-12-11 16:53:42
问题 I'm struggling for many hours now using activerecord-jdbcmssql-adapter with Rails 5.1 (or 5.2). I've installed ant to be able to compile the gem during the bundling. The bundle process runs fine but when I want to start rails I'm just getting Bundler::GemRequireError: There was an error while trying to load the gem 'activerecord-jdbcmssql-adapter'. Gem Load Error is: undefined method `type_cast_from_database' for class `ArJdbc::MSSQL::UUIDType' I've googled a lot but didn't find a solution or

org.jruby.embed.EvalFailedException: (LoadError) no such file to load

﹥>﹥吖頭↗ 提交于 2019-12-11 14:56:09
问题 I've created jar file from ruby code using warbler. File structure within jar is as below: core.jar ----core --------lib ------------gui.class ------------gui.rb I've other java application from which I want to run "connect" function which is in Gui class of gui.rb. I've tried below code in java: ScriptingContainer SCRIPTING_CONTAINER = new ScriptingContainer; // String CORE_JAR_PATH = "core.jar"; String CORE_JAR_PATH = "core.jar!/core/lib"; SCRIPTING_CONTAINER.getLoadPaths().add(CORE_JAR

jRuby/Ruby on rails database relations and data retrieve

时光毁灭记忆、已成空白 提交于 2019-12-11 13:55:58
问题 This question links to my earliest Question here. I have a model "User" and scaffold "ContactDetail" which relate to each other as below. Each User has_many ContactDetail ContactDetail belongs_to User My Question How can I load all the contact details to my html upon successful login? If user is a new user and has no contact details so far, I want to show contact_details' new.html.erb inside my html. Can I do that? This is what I tried so far In my login sessioncontroller.rb I create

jruby annotation method not getting called

廉价感情. 提交于 2019-12-11 12:05:35
问题 I have a jar named test.jar which contains following java classes: Test.java package test; import java.lang.reflect.Method; public class Test { public static void yoyo(Object o) { Method[] methods = o.getClass().getMethods(); for (Method method : methods) { CanRun annos = method.getAnnotation(CanRun.class); if (annos != null) { try { method.invoke(o); } catch (Exception e) { e.printStackTrace(); } } } } } and interface CanRun.java package test; import java.lang.annotation.ElementType; import

Every time I tried to load gems for Jruby it gives me this error. This is after entering “gem install rails”. Help please?

非 Y 不嫁゛ 提交于 2019-12-11 11:40:36
问题 I am trying to download gems for jruby-1.7.0.RC2 but i get this error every time I try to push it through. Error: Your application used more stack memory than the safety cap of 2048K. Specify -J-Xss####k to increase it (#### = cap size in KB). Specify -w for full StackOverflowError stack trace 回答1: If you are using RVM to manage your Ruby runtimes, be sure to update it. See https://github.com/jruby/jruby/issues/331. 回答2: That because Everytime you run gem install rails it check for capsize

Compile all .rb files of a Ruby on Rails app to .class using JRuby, pack it into a .war and deploy into a Java appserver

最后都变了- 提交于 2019-12-11 07:43:12
问题 Is it possible to compile all .rb source files files (including the configuration source file files) of Ruby on Rails to .class files using JRuby, pack it into a .war file and deploy to JBoss or another Java appserver? 回答1: Check out warbler for this purpose. From the main page: Warbler is a gem that makes a .war file out of a Rails, Merb, or Rack-based application. The intent is to provide a minimal, flexible, ruby-like way to bundle all your application files for deployment to a Java

Is JRuby's implementation of Kernel#__method__ broken?

拜拜、爱过 提交于 2019-12-11 06:57:15
问题 This is the description of Kernel#__method__ according to Ruby-Doc.org (emphasis added): Returns the name at the definition of the current method as a Symbol. If called outside of a method, it returns nil . Now consider the following code snippet: DEFINITION = proc { __method__ } class C define_method :one, DEFINITION define_method :two, DEFINITION end o = C.new When I run the following using MRI v1.8.7+ I'm getting the expected results: o.one #=> :one o.two #=> :two However when I run the