jrubyonrails

JRuby on Rails vs. Ruby on Rails, what's difference?

两盒软妹~` 提交于 2019-12-11 04:44:42
问题 I'm looking to try out JRuby and JRuby on Rails. I'm having trouble finding information on what's difference between JRuby on Rails and Ruby on Rails. What's the differences I need to look out for? N.B. This questions is an exact duplicate of JRuby on Rails vs. Ruby on Rails, what's difference?, except the original question was answered 2.5 years ago. I'm hoping for an up-to-date answer. 回答1: The original answer still stands and isn't really time specific. JRuby is just a version of Ruby that

JRuby 1.7.0 will not install bundler given plenty of memory

天涯浪子 提交于 2019-12-10 22:46:22
问题 I installed jruby with rvm install jruby-1.7.0 and it ran out of memory when it tried to create the gemsets so I started by trying to install bundler with the new version and this is what I get ~>gem install bundler 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 So I moved up the memory and I still got nothing with a huge chunk of memory ~>JRUBY_OPTS=-J

Make JRuby inherit Java proxy settings

若如初见. 提交于 2019-12-10 14:46:12
问题 I would like to make HTTP requests from Rails code running on top of JRuby. How can I make it to re-use http.proxyHost, http.proxyPort and http.nonProxyHosts settings, given to JVM running it ? 回答1: To pass JVM flags through JRuby, use -J... . In this case: jruby -J-Dhttp.proxyHost=foo -J-Dhttp.proxyPort=1234 -J-Dhttp.nonProxyHosts="*.bar.com" ... This is explained in JRuby's help text. -J[java option] pass an option on to the JVM (e.g. -J-Xmx512m) use --properties to list JRuby properties

JRuby on Rails: Using custom Java classes in your Rails app

限于喜欢 提交于 2019-12-10 13:23:12
问题 I just started with JRuby on Rails and absolutely love it. I know how to use current classes within the Java API in my Rails app, but if I wanted to create a new custom class written in purely Java code, how would I be able to use it in my Rails app? For example, let's say I created Dog.java: class Dog { private String name; public Dog() { name = "Fido"; } public String getName() { return name; } } How would I be able to create a new Dog object (Dog.new) in my Rails app? I need to put the Dog

Flag invalid attribute in ActiveRecord

泄露秘密 提交于 2019-12-07 13:22:57
问题 I am trying to implement functionality wherein an attribute, once set, cannot be changed on an ActiveRecord model. To this end, I have written the following methods: def address self[:address] end def address=(val) if new_record? self[:address] = val else errors.add(:address, "Cannot change address, once it is set") return false # tried return nil here first, did not work end end Am I doing something wrong here? I want the object to be invalid once I try to change an address, but I do not get

Is there a way to debug a JRuby on Rails application running on a Tomcat server in eclipse?

ぐ巨炮叔叔 提交于 2019-12-06 13:55:50
问题 I have a JRuby on Rails application running on Tomcat 7 server. I use Eclipse as IDE. Is there a way to trigger breakpoints in the Ruby code? If not, is there any other way to debug the application? (and I rather not use messages be printed to the console). I suppose that if it doesn't work with Eclpse, it won't work with IntelliJ either. 回答1: The JRuby on Rails application that we are currently developing will ultimately be deployed to a Tomcat server. During development, however, we use the

Flag invalid attribute in ActiveRecord

三世轮回 提交于 2019-12-05 20:04:31
I am trying to implement functionality wherein an attribute, once set, cannot be changed on an ActiveRecord model. To this end, I have written the following methods: def address self[:address] end def address=(val) if new_record? self[:address] = val else errors.add(:address, "Cannot change address, once it is set") return false # tried return nil here first, did not work end end Am I doing something wrong here? I want the object to be invalid once I try to change an address, but I do not get any errors when I do obj.valid? EDIT: The value is not changed once it is set, but I would like to get

JRuby on Rails vs. Ruby on Rails, what's difference?

故事扮演 提交于 2019-12-03 00:22:05
问题 I'm looking to try out JRuby and JRuby on Rails. I'm having trouble finding information on what's difference between JRuby on Rails and Ruby on Rails. What's the differences I need to look out for? 回答1: JRuby is the Ruby implementation that runs on a JVM whereas Matz's Ruby is a C implementation. Key features to note are: JRuby runs on Java VM's and it's either compiled or interpreted down to Java byte code. JRuby can integrate with Java code. If you have Java class libraries (.jar's), you

JRuby on Rails vs. Ruby on Rails, what's difference?

拈花ヽ惹草 提交于 2019-12-02 14:02:20
I'm looking to try out JRuby and JRuby on Rails. I'm having trouble finding information on what's difference between JRuby on Rails and Ruby on Rails. What's the differences I need to look out for? user23117 JRuby is the Ruby implementation that runs on a JVM whereas Matz's Ruby is a C implementation. Key features to note are: JRuby runs on Java VM's and it's either compiled or interpreted down to Java byte code. JRuby can integrate with Java code. If you have Java class libraries (.jar's), you can reference and use them from within Ruby code with JRuby. In the other direction you can also

Failed to build gem native extension with JRuby

南笙酒味 提交于 2019-12-01 00:59:17
I change the ruby version from ruby 1.9.3-p125 to JRuby 1.7.0-preview1 with ruby-build . When I execute jruby -S bundle install on my project, there are some errors as below, ... Using bson (1.6.2) Installing bson_ext (1.6.2) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /Users/joshchang/.rbenv/versions/jruby-1.7.0-preview1/bin/jruby extconf.rb NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS or modify .jrubyrc to enable. (root) at /Users/joshchang/.rbenv/versions/jruby-1.7.0