Class: WPDB::Option

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-wpdb/options.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.get_option(name) ⇒ Object

Given the name of an option, will return the option value for that option - or nil of no option with that name exists.

Parameters:

  • name (String)

    The option_name to fetch

Returns:

  • String



20
21
22
# File 'lib/ruby-wpdb/options.rb', line 20

def self.get_option(name)
  Option.where(:option_name => name).get(:option_value)
end

Instance Method Details

#before_validationObject



10
11
12
13
# File 'lib/ruby-wpdb/options.rb', line 10

def before_validation
  self.autoload ||= "yes"
  super
end

#validateObject



5
6
7
8
# File 'lib/ruby-wpdb/options.rb', line 5

def validate
  super
  validates_presence [:option_name]
end