How to update rails 3.0.3 to 3.1? - ruby-on-rails

How do I update to Rails 3.1 ?
I am using windows xp with ruby console.
And is there a smart way to update a rails app from 3.0.3 to 3.1 or do I need to rewrite it all?

This question has a lot of useful information which might help you out: Upgrading from Rails 3 to Rails 3.1
It doesn't answer specifically for Windows, but there's a lot of advice and insight that you'll find useful for the upgrade.
The only advice I can offer on top of reading the answers in the above question is to have a bit of patience and not expect it to work straight away. There's a lot of changes in the way 3.1 works so expect to spend some time fixing it up.
Good luck!

I created one vanilla 3.0 site, added it to Git, then created a vanilla 3.1 site and copied it over the 3.0 site, deleting existing files first. A diff then showed me exactly what changed.

I would strongly recommend this and the following two railscasts in the series

Related

What are the new Rails critical security fixes?

I got these updates from rails:
I'd like to announce that 3.2.11, 3.1.10, 3.0.19, and 2.3.15 have been released. These releases contain two extremely critical security fixes so please update IMMEDIATELY.
link
as it says it's critical. I just updated my application with rails 3.1 to 3.11 and did bundle update rails. My questions are:
What was the actual loophole in rails that has now been fixed?
As a learner I'm eager to understand what the problem was and how has it been fixed. I couldn't get anywhere about this.
Is it really a big loophole, and is there any problem for all Rails application which haven't been updated?
Here's an explanation of the hack : http://charlie.bz/blog/rails-3.2.10-remote-code-execution
And the original post by tenderlove : https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/61bkgvnSGTQ
Basically, anyone can inject XML and instantiate any kind of Ruby object using YAML ... it's complicated, but works on all apps (except the patched one of course, and Rails 1.X) and can even execute system commands ...
Anyone having Rails apps around should already have upgraded ... if not, do it NOW!

Is it okay to use Rails 3.1 for a new project? Is hard to convert over?

I have just started using 3.0.7. I am about 2 weeks of development in.
I was wondering if I should keep building for 3.0.7 or switch to 3.1 before I have too much code to port over? I like most of the new features (my only fear is not having good error messages when I use coffeescript), so I'd like to code towards the latest and greatest if it's relatively safe.
The javascript standards look interesting, and the attr_accessible fix sounds like it's very much appreciated.
Is Rails 3.1 compatible with all the gems out there though?
Also, if I go the 3.1 route, is hard or easy to migrate my project towards it? How might one go about that?
I guess this is a lot of mini yet related questions. I'd really appreciate some answers. Thank you.
I think if you want to ride on Rails 3.1 you should do it :). As for me I have some projects on Rails 2.3.5, 3.0.5 and would like to port them on Rails 3.1 but there is to much code there :). So don't be afraid and go to the fresh stuff (unless your code overflow :) ).
Rails 3.1 are pretty stable for now (I didn't have much problems with installing and using it)
If you're only two weeks into a project then it makes sense to stay on the edge and move to 3.1.
The way I'd do it is clone my project to a new dir (you're using git / similar version control, right?), change the Rails version in my Gemspec, run tests and play around to see what got broken (if anything). Based on the results you can figure out whether the effort is too great.
Regarding gem compatibility, hardly anything is compatible with all gems out there. Since you're two weeks in, you probably know which gems you use. Test like I suggested and you'll have an idea whether it's compatible with what you need. If you're using popular gems, then they'll most likely be updated to work with 3.1 soon enough.

Is it worth the switch over from Rails 2 to Rails 3 if im starting a new application?

is it worth the change from Rails 2 to 3 if im starting to work on a new application? are all the plug-ins and gems available for 2 now available for 3 as well? im used to developing and learning on Rails 2 and I'm afraid of switching over.
Thank You
You can check if the plugins you use work with Rails 3 here. Personally I'd say, if all the plugins that you use work with Rails 3 then you should upgrade, there are some nice changes in Rails 3 that are worth using.
I just started a Rails project a few weeks ago with Rails 3, and I've been quite happy so far.
Some gems/plugins don't quite work yet. For example, Selenium and friends seem to be a little behind, though after trying a few plugins I finally got it working fine through Capybara. In_place_editing isn't working out-of-the-box for me (I suspect because of Rails 3), though there are alternatives and it's not complex at all. And I had some trouble with factory_girl, though apparently there is a version for Rails 3 now.
But in general, most plugins I've tried seem to be working fine at this point. Maarons has already pointed you at RailsPlugins.org if you want to check for a specific plugin.
Finally, there are bunch of things that are just better in Rails 3 (see the release notes). I used Rails 2 for a smaller project a while back, and using Rails 3 now, I was pleasantly surprised by the new routing (much less confusing), and the added bundler support (makes deploying much less scary).
Since you're setting up a new project, I'll also mention that I've been quite happy with Ruby 1.9.2 (as opposed to 1.8.7). Check PragDave's blog post for some major changes. The only thing that I recall needing explicit tinkering was the debugger -- just use the ruby-debug19 gem and you'll be fine.
Fear isn't a good enough reason not to switch.
There are quite a few plugins that only work on Rails 3, so I'd recommend starting a new project with 3, if you're starting now.
I would expect this question the other way around :)
If you are starting a new application then I'd say always try to go for the latest stable versions unless there is some really good reason not too.
Not only does it save you the trouble of migrating at a later stage (which in a likely hood will happen sooner or later), but you get to improve on a personal level as well by learning something new. And the later is something I find very important. If it's not challenging, it's not fun, and if it's not fun, then it's not gonna be good (for me at least).
As for all plug-ins and gems being available, probably not but the ones that are still being develped and improved will be if they are not already.
You will have to switch eventually, so this is a good time. Why waste time on something you will have to change sooner or later? Rails ecosystem is quite responsive, and most plugins and gems are already 3.x compatible. Many have even deprecated 2.x support.

Can Ruby 1.9 used with Rails by a Ruby/Rails beginner?

About half a year ago, when I started to learn Ruby and Rails, I first tried Ruby 1.9 but I soon gave up, because at that time nothing worked out of the box and almost every helping blog or tutorial was designed for Ruby 1.8.
What about now? (Dec 2009) Is it possible to get an existing Rails application running by a Ruby and Rails beginner without running into problems which can only be fixed by an absolute Ruby and Rails professional?
Unfortunately I dind't have good experiences with Ruby 1.9 and Rails.
You can read more here: Has anyone successfully deployed a Rails project with Ruby 1.9.1?
My opinion is that migrating an existing Rails app from Ruby 1.8.x to Ruby 1.9.1 is not as easy as you would think, event with an excellent test suite.
I'm also quite sure that most of the problems arise from trying to convert an existing application because you are working with an established code base.
Starting with a new Rails app with Ruby 1.9 should probably easier because you can trace a problem as soon as you write a single line of code so you can easily isolate which component is not compatible.
When migrating an existing app I had hard time trying to figure out which stack level was actually not compatible with Ruby 1.9. And there are more than one incompatible libraries at the same time I can't tell you how it's difficult to understand which one should be fixed first and which one originated the final error.
In 99.9% of the cases yes, there were rare cases where u might find problems but they should be solved with the new release.
As for the external gems and plugins, most of them now are fully compatible with ruby 1.9, however sepcial cases might exist but I'm not aware of any right now.

Coming back to Rails

So I've decided after a few years away, that I want to get back into Ruby on Rails for some of my personal projects. What I'm wondering is what are the best resources to find out what the new features are in rails? I haven't really even touched Rails since 1.2 was new.
Oh yeah, and is TextMate still the defacto editor for RoR on the Mac, or has something better come along?
Check out the official Rails Guides. These should provide a nice overview of Rails (if you are rusty) and are kept up-to-date with the latest versions.
You may want to check out Ryan Daigle's Edge Rails posts which covered features as they were added to the new versions. Use the dates to determine where to start and go through each one. He also has a PDF for $9 which covers upgrading to Rails 2.1.
I have also covered the changes on Railscasts. Check out the various tags for each version to see them: 2.0, 2.1, 2.2, 2.3.
Update: Thoughtbot blog has posted about upgrading to Rails 2.1 and 2.3.2.
I found the book Agile Web Development With Rails (3rd edition) to be the most helpful to get me going again earlier this year. In particular it notes some concepts that have changed as well as introducing the new items.
Regarding editing, Textmate still seems to be #1 among the MacRails folks, the text-editing ones, at least.
Beyond that, there are some IDEs around now, if that's your preference. They're starting to become fairly not-awful, which is pretty impressive really. There are plenty of questions here that touch on the topic: try searching for "ruby rails ide"
The Ruby Toolbox is a great and fairly new resource for seeing what gems/plugins/tools are popular for various aspects of your application such as authentication, testing frameworks, search, etc. It's based on the number of watchers and forks each project has on GitHub, which is a reasonably good way of judging popularity.
As for a newer editor ...
I have found that sublime text is a great editor for ruby and rails projects, it has great syntax highlighting out of the box, Vim keybindings available (vintage mode), a sweet package system to add functionality for other languages like SASS or Coffeescript and an excellent file browser that helps with complex folder structure that can happen in a rails project.
Also, it is highly extendible and configurable, I switched to it from Vim.
http://www.sublimetext.com/

Resources