Class: SuperAuth::ActiveRecord::Authorization
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- SuperAuth::ActiveRecord::Authorization
- Defined in:
- lib/super_auth/active_record/authorization.rb
Class Method Summary collapse
-
.compile! ⇒ Object
Clears and repopulates the authorizations table from the current graph.
-
.from_graph ⇒ Object
Returns all computed authorization paths as Authorization AR objects.
Class Method Details
.compile! ⇒ Object
Clears and repopulates the authorizations table from the current graph.
12 13 14 15 16 17 18 |
# File 'lib/super_auth/active_record/authorization.rb', line 12 def compile! transaction do delete_all from_graph.each { |auth| create!(auth.attributes.except("id")) } end count end |
.from_graph ⇒ Object
Returns all computed authorization paths as Authorization AR objects. These can be saved directly to the super_auth_authorizations table.
7 8 9 |
# File 'lib/super_auth/active_record/authorization.rb', line 7 def from_graph from("(#{SuperAuth::Edge..sql}) as super_auth_authorizations".squish) end |