jrubyonrails

Logging with log4j on tomcat jruby-rack for a Rails 3 application

一世执手 提交于 2019-11-30 09:30:11
I just spent the better part of 3 hours trying to get my Rails application logging with Log4j. I've finally got it working, but I'm not sure if what I did is correct. I tried various methods to no avail until my very last attempt. So I'm really looking for some validation here, perhaps some pointers and tips as well -- anything would be appreciated to be honest. I've summarized all my feeble methods into three attempts below. I'm hoping for some enlightenment on where I went wrong with each attempt -- even if it means I get ripped up. Thanks for the help in advance! System Specs Rails 3.0

Convert a Ruby on Rails project to a JRuby on Rails project

你离开我真会死。 提交于 2019-11-30 08:32:52
问题 is there any particular way to convert a Ruby on Rails project to a JRuby on Rails project? There now is a need to get the Rails side to talk to a Java server via RMI so was wondering how to make the conversion. Thanks. 回答1: As @Karl says, it pretty much works but there are a number of caveats you should be aware of: The database adapters will be different from the ones you may be used to. They're based on JDBC. For example, the MySQL adapter install is described here You will generally

How to test cookies.permanent.signed in Rails 3

放肆的年华 提交于 2019-11-30 04:49:27
I have a action in some controller that set some value in a permanent signed cookie like this: def some_action cookies.permanent.signed[:cookie_name] = "somevalue" end And in some functional test, I'm trying to test if the cookie was set correctly suing this: test "test cookies" do assert_equal "somevalue", cookies.permanent.signed[:cookie_name] end However, when I run the test, I got the following error: NoMethodError: undefined method `permanent' for # If I try only: test "test cookies" do assert_equal "somevalue", cookies.signed[:cookie_name] end I get: NoMethodError: undefined method

How do I use JRUBY_OPTS with RVM?

戏子无情 提交于 2019-11-30 02:20:53
It seems that the idiomatic way to provide flags to JRuby in an RVM-based Rails project is to set the environmental variable JRUBY_OPTS or PROJECT_JRUBY_OPTS, the latter perhaps being done automatically, since I see I can uncomment this line from my project directory's .rvmrc : PROJECT_JRUBY_OPTS=( --1.9 ) However, that line seems to do nothing, and if I set the environmental variables, RVM actually unsets them. So, how am I supposed to do this? (Note that I have this at the bottom of my .bashrc file, which is how I believe I'm supposed to use rvm:) [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "

Logging with log4j on tomcat jruby-rack for a Rails 3 application

风格不统一 提交于 2019-11-29 14:22:30
问题 I just spent the better part of 3 hours trying to get my Rails application logging with Log4j. I've finally got it working, but I'm not sure if what I did is correct. I tried various methods to no avail until my very last attempt. So I'm really looking for some validation here, perhaps some pointers and tips as well -- anything would be appreciated to be honest. I've summarized all my feeble methods into three attempts below. I'm hoping for some enlightenment on where I went wrong with each

How to test cookies.permanent.signed in Rails 3

人走茶凉 提交于 2019-11-29 02:16:25
问题 I have a action in some controller that set some value in a permanent signed cookie like this: def some_action cookies.permanent.signed[:cookie_name] = "somevalue" end And in some functional test, I'm trying to test if the cookie was set correctly suing this: test "test cookies" do assert_equal "somevalue", cookies.permanent.signed[:cookie_name] end However, when I run the test, I got the following error: NoMethodError: undefined method `permanent' for # If I try only: test "test cookies" do

How do I use JRUBY_OPTS with RVM?

最后都变了- 提交于 2019-11-28 23:12:19
问题 It seems that the idiomatic way to provide flags to JRuby in an RVM-based Rails project is to set the environmental variable JRUBY_OPTS or PROJECT_JRUBY_OPTS, the latter perhaps being done automatically, since I see I can uncomment this line from my project directory's .rvmrc : PROJECT_JRUBY_OPTS=( --1.9 ) However, that line seems to do nothing, and if I set the environmental variables, RVM actually unsets them. So, how am I supposed to do this? (Note that I have this at the bottom of my