klass = Object.const_get(params[:controller].singularize.camelize)
Which was working fine until I had a controller that doesn't have a matching model. Eg. Home
NameError: uninitialized constant Home
To handle this I needed to do a rescue to the error
rescue NameError
return true
No comments:
Post a Comment