So.. I’m trying to do something like this:
"active_record_object" => ActiveRecordObject
with the following code:
ar_object = (object.singularize.split("_").each{|o| o.capitalize!}).join.constantize #convert to ActiveRecord object
is there a more efficient way to do this? chaining 7 string manipulation methods together seems a lil crazy for ruby.
There’s a method called
classifyfor that:Edit: as pointed out in the comments,
"active_record_object".classify.constantizegets you all the way.