I am migrating a rails 2.3.5 project to rails 3.
I get a lot of errors in the lines when i am using:
params[:something]
that i have to change ti with:
request.path_parameters[:something]
It this right? I am unable to found something about this in rails3 migration guides.
My controller:
def details
foo=Tag.find(params[:id])
end
and i get the following error:
ActiveRecord::RecordNotFound
Couldn't find Tag without an ID
You are missing the ":" in params[:id].
That may be the reason you're receiving the error.
Aside from your error, which is probably due to the missing : as tapioco123 pointed out, are you using the rails_upgrade plugin?
https://github.com/rails/rails_upgrade
There are also three excellent screencasts by Ryan Bates at railscasts on upgrading from rails 2.3.5 to 3.0.
http://railscasts.com/episodes?utf8=%E2%9C%93&search=upgrading+rails+3
This will help you switch over to some of the new features rails 3 offers and prepare you for rails 3.1 which is expected to be released soon and may not show all the depreciation messages that rails 3.0 will.
Good luck with upgrading.
Related
Update: The Question is Still Open, any reviews, comments are always welcome
As I already know lot QA's in stackoverflow regarding my topic, but most of them are closed and not properly answered.
Question 1) Steps for Migrating Rails 2.3.5 to Rails 3.x.x
Question 2) PitFalls and Traps
Question 3) Error Prone & Painfull Migration Phases
Note: I need Real Answers,Stuffs,Reviews and Suggestions are welcome, from those who involved in project migration from Rails 2.x.x to Rails 3.x.x
This has been answered in another question, How to update rails 2.3.10 to 3.x
But here is what I learned from an attempt at upgrading. Have to try again since the first attempt failed.
One of the most useful things I found in it was this plugin.
https://github.com/rails/rails_upgrade/blob/master/README
That would answer 1) with the steps for upgrading.
Also, it is a lot easier to upgrade to 3.0 than to 3.1 or 3.2. 3.0 -> 3.1 breaks a lot of stuff.
The suggestion is to do 2.3 -> 3.0 -> 3.1 -> ... all separately
2) named scopes like they are used in 2.3 don't work with 3.x - they have to be replaced with the Rails 3 version of scopes. For me the most annyoing things are some gems which haven't been upgraded to use Rails 3, so I have to figure out a replacement or throw them out. Also Rails 3 insists on marking all the text I output from helpers and from every other place than views as unsafe, which is really annoying. I can't remember now what we did to fix that.
3) Everything is very painful with upgrading Rails.
Edit: I found this presentation today, seems very informative, http://www.slideshare.net/crnixon/rails-3-7983843
I have a project that uses the WYSIWYG editor 'wysihat-engine' by Dutch guys from 80beans . It use to work fine with Rails version 3.0.9 , but after upgrading to 3.1.0 the wysihat-engine cannot find 'html_escape' from ERB::Util (ActiveSupport 3.1.0) , giving me this error message :
undefined method `html_escape' for #<ActionView::Helpers::InstanceTag:my-wysihat-editor- instance>
I've fixed it (verrrry lamely , indeed) by defining the 'html_escape' inside 'wysihat-engine.rb' , but I'm sure , there's a reason not to do it this way :).
My questions :
1. Is this a bug of the new version of Rails ?
2. Is there a better choice for WYSIWYG editor for a Rails 3.1 projects ?
Thank you in advance .
The wysihat-engine doesn't seem to be compatible with Rails 3.
I've tried to install it in a fresh Rails 3.1 application, but the generator fails when it tries to generate a database migration:
$ rails generate wysihat
~/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.0/lib/rails/generators/migration.rb:30:in `next_migration_number': NotImplementedError (NotImplementedError)
from ~/.rvm/gems/ruby-1.9.2-p290#rails31/gems/railties-3.1.0/lib/rails/generators/migration.rb:49:in `migration_template'
from ~/.rvm/gems/ruby-1.9.2-p290#rails31/gems/wysihat-engine-0.1.13/lib/generators/wysihat_generator.rb:60:in `install_wysihat'
I'm surprised you even got as far as the html_escape error you posted. Fixing this would take some poking in the source code. You could ask the developer for info.
This is my first question here in StackOverflow :)
I've been searching for the best plugin for administrator for my Rails 2.3.11 app.
I can create my own but I have to rush my project so I decided to use these kinds of plugin.
I already searched rails_admin and active_admin. There are both good but I think that's for Rails 3 only. So I need to find some admin plugins for Rails 2.3.11.
Your ideas are much welcome :) Thanks!
Give Typus a try. It works on rails 2.3 and is quite popular, although the author isn't planning on maintaining the 2.3 version anymore.
https://github.com/typus/typus/wiki/requirements
I am looking for NEW Ruby on Rails resource websites (Screencasts, Tutorials, etc) some of what I found are Outdated. So for Ruby on Rails 3.X please.
I have:
http://railscasts.com/
http://railsforzombies.org (witch is...AWESOME, a kick-start)
http://railsapi.com/doc/rails-v3.0.1/
I'd recommend newer Railscasts and great RailsGuides.
I've been reading the RailsTutorial for Rails 3 and think it's amazing.
http://railstutorial.org/
If you have an existing Rails app to upgrade, you'll probably also want to check out Jeremy McAnally's Rails 3 Upgrade
Handbook.
Peepcode are good too. Not a free resource
http://peepcode.com/
What is the source (url) for Rails Engines that works with rails 2.2.2?
I'd get the current source from github and search for "engine".
It looks like the Rails Guides did not start until Rails 2.3.8. I could not find guides for anything less than Rails 2.3.8.
http://guides.rubyonrails.org/v2.3.8.
Additionally, Rails Engines were something introduced in Rails 2.3, though similar functionality may have been present in Rails 2.2 through Plugins.
http://railscasts.com/episodes/149-rails-engines?autoplay=false