Q:

convert string into class name in rails

I have a variable handler whose value can be flight_gds, flight_commission etc. 
There are classes in my application which has names like FlightGds, FlightCommission etc.  under module FlightManager.  
I want to execute the function of class based on the value of the handler.  
The function name is same in all classes, only the class name is different which is dependent on
the handler. 
For example: 
If handler name is 'flight_gds', then the function is FlightManager::FlightGds.calculate()
I am trying something like this:
FlightManager::handler.camelize.calculate()

But I am getting undefined method handler error. 
Is there any way to do this or I should go with if/else loop? 

A:

You should use constantize to get a class based on it's name in string:
"FlightManager::#{handler.camelize}".constantize.calculate())

