inspectar 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/inspectar/version.rb +1 -1
- data/lib/inspectar.rb +3 -7
- metadata +1 -1
data/lib/inspectar/version.rb
CHANGED
data/lib/inspectar.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
require "active_record"
|
2
2
|
require "inspectar/version"
|
3
3
|
|
4
|
-
class Connectar < ActiveRecord::Base
|
5
|
-
|
6
|
-
end
|
7
|
-
|
8
4
|
module Inspectar
|
9
5
|
|
6
|
+
class Connectar < ActiveRecord::Base; end
|
7
|
+
|
10
8
|
def self.attach(params)
|
11
9
|
ActiveRecord::Base.configurations["inspectar"] = params
|
12
10
|
Connectar.establish_connection params
|
@@ -42,9 +40,7 @@ end
|
|
42
40
|
end
|
43
41
|
|
44
42
|
def self.fetch
|
45
|
-
|
46
|
-
tables = conn.execute("show tables").map { |r| r[0] }
|
47
|
-
tables.map{|table| {table_name: table, model_name: table.tableize.camelize.singularize}}
|
43
|
+
Connectar.connection.tables.map{|table| {table_name: table, model_name: table.tableize.camelize.singularize}}
|
48
44
|
end
|
49
45
|
|
50
46
|
end
|