文字列からクラス名にアクセスする方法

constantizeを使用します。

"Topic".constantize
=> Topic(id: integer, title: string, body: text, category_id: integer, thumbnail_updated_at: datetime, thumbnail_file_size: integer, thumbnail_content_type: string, thumbnail_file_name: string, created_at: datetime, updated_at: datetime, name: string)

定義ファイル activesupport-4.2.7.1/lib/active_support/core_ext/string/inflections.rb @ line 65:

def constantize
  ActiveSupport::Inflector.constantize(self)
end

自分自身を返してアクセスしている。

以上です。