Class: WPB::App

Inherits:
Object
  • Object
show all
Defined in:
lib/wpb.rb

Class Method Summary collapse

Class Method Details

.connectObject



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/wpb.rb', line 32

def self.connect
 config = {
:adapter  => "mysql",
    # :socket   => "/tmp/mysql.sock", 
:host     => "localhost",
:username => "root",
:password => "root",
:database => "wordpress"
			}

			ActiveRecord::Base.establish_connection(config)
end

.runObject



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/wpb.rb', line 45

def self.run
	self.connect

PagePost.all.each do |p|
	p.type = p.post_type.capitalize
	if p.post_type != "post" && p.post_type != "page"
		p.type = "Post"
	end
	p.save
end
end