Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Split up methods so extensions can ask themselves these questions

  • Loading branch information...
commit a34ce6694982f7ea106897c0bbf8161a2a5cc3be 1 parent 63e7f5d
Kunal Shah authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/radiant/extension.rb
View
10 lib/radiant/extension.rb
@@ -15,6 +15,14 @@ def active?
@active
end
+ def migrated?
+ migrator.new(:up, migrations_path).pending_migrations.empty?
+ end
+
+ def enabled?
+ active? and migrated?
+ end
+
def migrations_path
File.join(self.root, 'db', 'migrate')
end
@@ -39,7 +47,7 @@ def admin
def extension_enabled?(extension)
begin
extension = (extension.to_s.camelcase + 'Extension').constantize
- extension.active? and extension.migrator.new(:up, extension.migrations_path).pending_migrations.empty?
+ extension.enabled?
rescue NameError
false
end
Please sign in to comment.
Something went wrong with that request. Please try again.