Class: CrazyTrain::Grant

Inherits:
Object
  • Object
show all
Defined in:
lib/crazy_train/grant.rb

Class Method Summary collapse

Class Method Details

.execute!Object



4
5
6
7
8
9
10
11
# File 'lib/crazy_train/grant.rb', line 4

def execute!
  sql "GRANT SELECT ON announcements TO #{CrazyTrain.config.unauthorized_role}"
  sql "GRANT SELECT ON announcements TO #{CrazyTrain.config.authenticated_role}"
  sql 'GRANT ALL PRIVILEGES ON announcements TO admin'
  sql 'GRANT ALL PRIVILEGES ON users TO admin'
  sql 'GRANT ALL PRIVILEGES ON notes TO admin'
  sql 'GRANT USAGE ON announcements_id_seq TO admin'
end

.sql(statement) ⇒ Object



13
14
15
# File 'lib/crazy_train/grant.rb', line 13

def sql(statement)
  ActiveRecord::Base.connection.execute(statement)
end