Rails 3 vs Rails 2 pluralization issue - ruby-on-rails

I am using rails 2 in my ruby on rails application.
In rails console when i try
"police".pluralize
then i get something like this:
"poluce"
I spent some time on searching this issue but haven't got proper answer.
Any clue about this ?
I tried it in Rails 3 it works fine.

This seems to be more or less a duplicate of this question:
How do I override rails naming conventions?
The key being that you can add any custom inflections that you want. To see a difference between Rails 2 and Rails 3 is not surprising. In fact, it is encouraging.

Related

What should a Rails 3.x noob know about maintaining a Rails 2.3 app?

I recently learned Rails (Rails 3 to be specific) and got a small project maintaining a Rails 2.3.2 app.
So, as you might expect, I keep running into differences between what I learned in Rails 3 and what I'm working in.
For example 'rails server' command in Rails 3 is 'script/server' in Rails 2.x.
What else should I know to maintain my sanity?
If you're new to rails, I don't know if you'll see a lot of differences. The rails server command is one thing however.
The other big thing is the use of .gemspec in Rails 2.3.5 instead of Bundler and Gemfiles in Rails 3. Installing gems/specifying which gems your app uses is way better in Rails 3 I think.
The rest are mostly syntax changes and depreciated functions in specific areas (e.g. javascript generators).
This Blog does a good job of listing most of the major changes in more detail.
Hope that helps!

Migration to rails 3

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.

Rails plugin with a different version of rails

I have a rails 3 app, and I want to use a plugin that requires rails_generator, which is no longer available in rails 3. Can I have the plugin run with Rails 2, and my app run with Rails 3?
EDIT:
I asked on IRC (#rubyonrails) and the answer is no :(
Rails 3 has a generator. Depending on the rest of the plugin though you might have to make modifications to make it Rails 3 compatible. You can run the generator like this:
rails generate ...

Infer associations/validations from existing database in Rails 3

Does Magic Model Generator work under Rails 3.0? I can't make it work, the install instructions that I found, doesn't help me.
Does exist an alternative to Magic Model Generator that can infer validations and associations from an existing database?
Thanx!
Looks like the MMG is abandoned -- it doesn't even work for Rails 2.3. However -- you could create a Rails 2.2 app and use it with MMG, then use the models in your Rails 3 app.
http://github.com/drnic/magic_model_generator

Source for updated rails engines

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

Resources