forked from jruby/activerecord-jdbc-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mssql] add a has_many :though tests + re-arrange tests a bit (closes j…
…ruby#171) NOTE: a failure commit fd27edf fixes was only reproducable with 3.0 and 3.1 while running in JRuby --1.8 mode
- Loading branch information
Showing
5 changed files
with
84 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
class CreateRightsAndRoles < ActiveRecord::Migration | ||
def self.up | ||
create_table :role_assignments do |t| | ||
t.column :role_id, :integer | ||
t.column :user_id, :integer | ||
end | ||
|
||
create_table :roles do |t| | ||
t.column :name, :string | ||
t.column :description, :string | ||
end | ||
|
||
create_table :permission_groups do |t| | ||
t.column :right_id, :integer, :null => false | ||
t.column :role_id, :integer, :null => false | ||
end | ||
|
||
create_table :rights do |t| | ||
t.column :name, :string | ||
t.column :controller_name, :string | ||
t.column :actions, :string | ||
t.column :hours, :float, :null => false | ||
end | ||
end | ||
|
||
def self.down | ||
drop_table :role_assignments | ||
drop_table :roles | ||
drop_table :permission_groups | ||
drop_table :rights | ||
end | ||
end | ||
|
||
class Right < ActiveRecord::Base | ||
has_many :permission_groups, :dependent => :destroy | ||
has_many :roles, :through => :permission_groups | ||
end | ||
|
||
class Role < ActiveRecord::Base | ||
has_many :permission_groups, :dependent => :destroy | ||
has_many :rights, :through => :permission_groups | ||
has_many :role_assignments, :dependent => :destroy | ||
|
||
def has_right?(right) | ||
rights.include? right | ||
end | ||
end | ||
|
||
class PermissionGroup < ActiveRecord::Base | ||
belongs_to :right | ||
belongs_to :role | ||
end | ||
|
||
class RoleAssignment < ActiveRecord::Base | ||
belongs_to :user | ||
belongs_to :role | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
require 'db/mssql' | ||
require 'serialize' | ||
|
||
class MsSQLSerializeTest < Test::Unit::TestCase | ||
class MSSQLSerializeTest < Test::Unit::TestCase | ||
include SerializeTestMethods | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters