GKK GKK - 1 year ago 150
Ruby Question

Ruby on Rails: How to check if the Model Exists

I want to know how to check if the model already exists in the project or not?

When user tries to create a model programatically using the same model name, need to check if it already exists or not?

Answer Source

defined? ModelName will return "constant" if model defined.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download