GKK GKK - 5 months ago 49
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

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

Comments