LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Ruby/Rails > Will there be official support for Rails >= 2.3

Reply
 
Thread Tools Display Modes
  #11  
Old 03-03-2009, 09:04 AM
russ816 russ816 is offline
New Member
 
Join Date: Oct 2008
Posts: 5
I got around to cleaning it up a bit. I'm sure there are other issues, so I just put it up on github for fixes.

http://github.com/russ/litespeed-rai...er/tree/master
Reply With Quote
  #12  
Old 03-05-2009, 10:43 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,586
That's good.

I think we still need to support older release of Rails and only use that for 2.3 and above.

In the code
Quote:
ActiveRecord::Base.clear_active_connections! if defined?(ActiveRecord::Base)
may not work well unless the function has been added back in, seems it is missing in latest rails 2.2 release.
That's why we need to update RailsRunner.rb to discount and reconnect the connection manually in the latest version.
Reply With Quote
  #13  
Old 03-10-2009, 11:50 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,586
Looks like

ActiveRecord::Base.clear_active_connections!

is coming back into ActiveRecord::Base in rails 2.3, so it should be fine.
I have to make the RailsRunner.rb compatible with Rails 1.x 2.2 and 2.3 by combining the current RailsRunner.rb and the one you put up on github.

Is there any easy way to detect the Rails version being used at the beginning?
Reply With Quote
  #14  
Old 03-16-2009, 10:26 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,586
I am thinking adding ruby code to extract the version number from file "RAILS_ROOT/config/environment.rb, at the beginning of the file,
"RAILS_GEM_VERSION" is set to the version of Rails should be used.

Can anyone help with the ruby code?
Reply With Quote
  #15  
Old 03-18-2009, 03:40 AM
kule kule is offline
Member
 
Join Date: Oct 2008
Posts: 20
Quote:
Originally Posted by mistwang View Post
I am thinking adding ruby code to extract the version number from file "RAILS_ROOT/config/environment.rb, at the beginning of the file,
"RAILS_GEM_VERSION" is set to the version of Rails should be used.

Can anyone help with the ruby code?
If I can help I will - what exactly are you after? Some additions to the github code above? e.g. do you just want to do something like

if RAILS_GEM_VERSION >= 2.3.2
# use rack
else
# use old system
end

or did you want to get the RAILS_GEM_VERSION number out to litespeed?
Reply With Quote
  #16  
Old 03-18-2009, 06:15 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,586
I am not sure we can do "require config/environment" at the beginning of the file or not. The code for 2.3 does not have that.
I am thinking about some ruby code to open config/environment.rb and search for RAILS_GEM_VERSION .
Reply With Quote
  #17  
Old 03-18-2009, 06:22 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,586
actually, config/boot.rb does exactly what I want. just need to duplicate that code.
Reply With Quote
  #18  
Old 03-18-2009, 06:45 AM
kule kule is offline
Member
 
Join Date: Oct 2008
Posts: 20
Quote:
Originally Posted by mistwang View Post
actually, config/boot.rb does exactly what I want. just need to duplicate that code.
Based on running in the rails root:
Code:
environmentrb = File.read('config/environment.rb')
puts $1 if environmentrb =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
If you have loaded rails then you can use:
Code:
File.read("#{RAILS_ROOT}/config/environment.rb")
and it'll pull in the full file path too.

Ta
Luke
Reply With Quote
  #19  
Old 03-18-2009, 07:18 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,586
I want to save the result in variable "raisl_ver"

Quote:
environmentrb = File.read('config/environment.rb')
rails_ver = $1 if environmentrb =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
Is above code correct?
Reply With Quote
  #20  
Old 03-18-2009, 07:21 AM
kule kule is offline
Member
 
Join Date: Oct 2008
Posts: 20
Quote:
Originally Posted by mistwang View Post
I want to save the result in variable "raisl_ver"
Is above code correct?
Yep looks good to me.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:04 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.