Ruby On Rails 2

 
Post new topic   Reply to topic    34SP.com Forum Index // Scripting Support
View previous topic :: View next topic  
Author Message
imknight
Administrator
Administrator


Joined: 16 Mar 2001
Posts: 3627
Location: Stroud,Gloucestershire

PostPosted: Thu Jan 03, 2008 12:34 pm    Post subject: Ruby On Rails 2 Reply with quote
Ruby on Rails 2 was released shortly before the end of last year - we have now updated all servers to be able to use this newer version

Full details of the changes made to RoR can be found in this post from the Ruby On Rails weblog:

http://weblog.rubyonrails.org/2007/12/7/rails-2-0-it-s-done

The 34SP hosting accounts are still setup to run this under FastCGI and the framework installer for the new version has been updated to use the new rails installer, as found at https://script.34sp.com/RoR2

For people wanting a more substantial Ruby On Rails account we do also have Rails VPS accounts available which run on Debian with Apache2 and Mongrel - full details on VPS accounts can be found at http://www.34SP.com/vps
_________________
Ian
34SP.com
Easy script installers for a small number of popular scripts are now available at http://scripts.34sp.com
Used our script installers? Please post your site here

| Wordpress Hosting |
Back to top
View user's profile Send private message Send e-mail Visit poster's website ICQ Number
imknight
Administrator
Administrator


Joined: 16 Mar 2001
Posts: 3627
Location: Stroud,Gloucestershire

PostPosted: Thu Jan 03, 2008 5:39 pm    Post subject: Reply with quote
Please note that gem was also updated in updating to RoR2 - and as such if you use the command

Code:

require_gem "rails"


or similar in your code your application may not start, this was depreciated some time ago and should be simply

Code:

gem "rails"


Please check files such as boot.rb for requests like this if you have any issues with your applications starting
[/code]
_________________
Ian
34SP.com
Easy script installers for a small number of popular scripts are now available at http://scripts.34sp.com
Used our script installers? Please post your site here

| Wordpress Hosting |
Back to top
View user's profile Send private message Send e-mail Visit poster's website ICQ Number
amcewen
34SP Newbie
34SP Newbie


Joined: 23 Nov 2005
Posts: 4
Location: Cambridge, UK

PostPosted: Fri Jan 25, 2008 10:36 am    Post subject: Some things I found when upgrading my Rails app to Rails 2 Reply with quote
There are quite a few changes with Rails 2.0, so I thought I'd summarise the things I had to do when I upgraded my rails app.

I found it better to change
Code:
require_gem "gem_name"

to
Code:
require "gem_name"


Config

If you get errors about needing a secret when you try to start your app, then you'll need to run
Code:
rake secret

to generate a secret, and then in config/environment.rb add:
Code:
ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:secret] = '<copy secret output from rake in here>'


If you're using ActionMailer to send emails then you'll also have to change the name of the settings, also in config/environment.rb. So:
Code:
ActionMailer::Base.server_settings = {

becomes:
Code:
ActionMailer::Base.smtp_settings = {


Deprecated items

Lots of stuff that was deprecated in Rails 1.2 has now been removed in Rails 2.0. Unfortunately, lots of example code and tutorials still contain the pre-deprecated code, so you'll probably have some lines to fix.

I couldn't find an official list of deprecated items, but http://i.nfectio.us/articles/2006/11/02/deprecations-in-rails-1-2 seems to be pretty definitive. There's also a very useful rake task at http://www.slashdotdash.net/articles/2007/12/03/rails-2-upgrade-notes which will run through your code and look for places where you're still using deprecated code.

Running rake on the 34sp servers

Finally, I had a number of rake tasks setup with cron to perform various maintenance jobs. They did look like this:
Code:
cd /usr/local/psa/home/vhosts/<your_domain>/httpdocs/<path_to_your_rails_app>/ && /usr/local/bin/rake RAILS_ENV=production <rake_task>

but that's stopped working recently (since the upgrade to Rails 2, but it might just be coincidence). I found that you need to export the path so that it can find ruby, so the cron jobs need to look like this (replace 'production' with 'development' if your Rails app is running in development mode):
Code:
export PATH=/usr/local/bin && cd /usr/local/psa/home/vhosts/<your_domain>/httpdocs/<path_to_your_rails_app>/ && /usr/local/bin/rake RAILS_ENV=production <rake_task>
Back to top
View user's profile Send private message Visit poster's website
Post new topic   Reply to topic    34SP.com Forum Index // Scripting Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Powered by phpBB © 2001, 2002 phpBB Group