Class: SuperAuth::ActiveRecord::Authorization

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/super_auth/active_record/authorization.rb

Class Method Summary collapse

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_graphObject

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.authorizations.sql}) as super_auth_authorizations".squish)
end