Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Model From Table Name

DZone's Guide to

Model From Table Name

·
Free Resource
Get the Rails model based on the table name.  Assumes standard table name conventions.


def model_for_table(table_name)
  table_name.classify.constantize
end
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}