Module: WPDB::GravityForms
- Defined in:
- lib/ruby-wpdb/gravityforms.rb
Defined Under Namespace
Classes: Detail, DetailLong, Form, FormMeta, Lead, ModelGenerator
Class Method Summary collapse
-
.const_missing(name) ⇒ Object
When a request is made to, for example, WPDB::GravityForms::SomeClass, this method will fire.
Class Method Details
.const_missing(name) ⇒ Object
When a request is made to, for example, WPDB::GravityForms::SomeClass, this method will fire. If there’s a GravityForm whose title, when camelised, is “SomeClass”, a model will be created for that form.
After the first time, the constant for that form will have been created, and so this hook will no longer fire.
185 186 187 188 189 190 191 192 193 194 |
# File 'lib/ruby-wpdb/gravityforms.rb', line 185 def self.const_missing(name) Form.each do |form| if name.to_s == WPDB.camelize(form.title) ModelGenerator.new(form).generate return WPDB::GravityForms.const_get(name) end end raise "Form not found: #{name}" end |