lib/generators/active_leonardo.rb in active_leonardo-0.0.2 vs lib/generators/active_leonardo.rb in active_leonardo-0.0.3
- old
+ new
@@ -1,16 +1,25 @@
module ActiveLeonardo
module Base
protected
+ def authorization_file
+ "app/models/ability.rb"
+ end
def authorization?
- File.exists? "app/models/ability.rb"
+ File.exists? authorization_file
end
- def authentication?
- return true if File.exists? "app/models/user.rb"
+ def authentication_file auth_class="User"
+ "app/models/#{auth_class.downcase}.rb"
+ end
+ def authentication? auth_class="User"
+ return true if File.exists? authentication_file(auth_class)
File.exists? "config/initializers/devise.rb"
end
+ def activeadmin_file
+ "config/initializers/active_admin.rb"
+ end
def activeadmin?
- File.exists? "config/initializers/active_admin.rb"
+ File.exists? activeadmin_file
end
#def formtastic?
# return false unless options.formtastic?
# File.exists? "config/initializers/formtastic.rb"
#end
\ No newline at end of file