LoginSignup
0
0

More than 5 years have passed since last update.

クラス名・ファイル名・テーブル名の変換

Posted at

クラス名からファイルパスへ変換(underscore)

 "AdminUser".underscore           # "admin_user"
 "Backoffice::Session".underscore # "backoffice/session"

ファイルパスからクラス名へ変換(camelize)

"product".camelize            # "Product"
"backoffice/session".camelize # "Backoffice::Session"

クラス名からテーブル名へ変換(tableize)

"Page".tableize      # "pages"
"AdminUser".tableize # "admin_users"

テーブル名からクラス名へ変換(classify)

"people".classify # "Person"
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0