Problem with the classify method from active support

G

Gregory Ma

Hi,

I am create a gem and I have encounter a problem using active_support
3.x and the classify method from the Inflector module.

If i am using active_support version 2.3.x I am able to do so:=> Car

But in ActiveSupport 3, things have changed a little. If I am reading
correctly
the module documentation
(https://github.com/rails/rails/blob/3-0-7/activesupport/lib/active_support/inflector/inflections.rb)
it should be working like this:
=> NoMethodError: undefined method `classify' for
#<ActiveSupport::Inflector::Inflections:0x101bb6848>

But it doesn't work... I really don't understand why I get the
NoMethodError as the method exists in the documentation and when I
autocomplete the inflections instance I have the classify method.

ps: i am not using Rails or the Rails Console

Does someone has any idea where this could come from?
GReg
 
X

Xavier Noria

I am create a gem and I have encounter a problem using active_support
3.x and the classify method from the Inflector module.

If i am using active_support version 2.3.x I am able to do so:
=> Car

But in ActiveSupport 3, things have changed a little. If I am reading
correctly
the module documentation
(https://github.com/rails/rails/blob/3-0-7/activesupport/lib/active_support/inflector/inflections.rb)
it should be working like this:

=> NoMethodError: undefined method `classify' for
#<ActiveSupport::Inflector::Inflections:0x101bb6848>

But it doesn't work... I really don't understand why I get the
NoMethodError as the method exists in the documentation and when I
autocomplete the inflections instance I have the classify method.

ps: i am not using Rails or the Rails Console

Does someone has any idea where this could come from?
GReg

The way to load Active Support changed with AS 3.0.0. I suspect your
code is loading active_support.rb, which is now really really light.
This is explained at the beginning of the Active Support Core
Extensions guide:

http://guides.rubyonrails.org/active_support_core_extensions.html#how-to-load-core-extensions

That's focused on core extensions, but if you do not want to have the
String class extended with inflection methods, the same principles
apply to non-core extensions.
 
G

Gregory Ma

Thanks again I have been able to fix this but I am encountering a new
issue.

If works fine with ActiveSupport 2.3.x mais but it doesn't work 3.0.x
Here is the line:

This line doesn't work in version 3 because it evaluates the last
condition, and the classify method doesn't exist in version 3.

What trick could I use?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top