Class: CreateExtremeAasTables

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/extreme_aas/templates/migration.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/generators/extreme_aas/templates/migration.rb', line 2

def change
  create_table :extreme_profiles do |t|
    t.timestamps
  end
  
  create_table :extreme_grants do |t|
    t.references :extreme_profile
    t.references :extreme_action
    t.boolean :volatile
    t.timestamps      
  end

  create_table :extreme_actions do |t|
    t.references :actionable, :polymorphic => true
    t.timestamps
  end
  create_table :extreme_simple_actions do |t|
    #--------
    t.string :controller_name
    t.string :action_name
    #--------
    t.string :helper_name
    t.string :method_name
    #--------
    t.timestamps
  end
  create_table :extreme_action_groups do |t|
    t.string :name
    t.boolean :volatile
    t.timestamps
  end
  create_table :extreme_action_edges do |t|
    t.integer :child_action_id
    t.integer :parent_action_id
    t.timestamps
  end
  
  ############## DEFAULT PROFILE ##############
  # default profile will have always id = 1
  profile = ExtremeAas::ExtremeProfile.create :id => 1
  grant = ExtremeAas::ExtremeActionGroup.create :name => 'default'
  profile.give_permission grant.super_action
  #############################################
  
end