ACTIVE_BRAC engine migration error

Hello Keegan,

You may already have forgotten about your posting from last month - but
I
stumbled across the EXACT same error today, and figured out a way around
it.

The difficulty stems from you running under Windows XP, probably running
InstantRails, right?

I fairly quickly discovered that the reason things were not working
according to the ActiveRBAC Manual was that
the code for ActiveRBAC assumes that you are running under a LINUX
system

  • or at least your file system follows
    the LINUX convention of /dir/some_other_dir/something_else/foo/bar…

The offending code (at least so far for me) is a routine named realpath
in
the file
InstantRails\ruby\lib\ruby\1.8\pathname.rb

Since I am running InstantRails under Windows XP, I had to find a way
around this issue to continue with
exploring ActiveRBAC.

I eventually got around this issue, but not by using the “rake
db:migrate:engines” command.

I have uploaded a batch file and 9 other supporting files in a ZIP file
attached to this message.

You need to:

  • download the ZIP file,

  • unzip the contents into the application directory for which you are
    trying to place the ActiveRBAC code

  • Open a Ruby console window - I open mine from the InstantRails
    application’s “Manage Rails Applications…”
    dialog box

  • change into the unziped directory (_create_db)

  • run the command rbac_mysql_doit.bat

This will populate a database named “rbac_test” with those tables needed
for RBAC, plus the tables used in the
“Articles” sample program listed within the ActiveRBAC Manual.

This set of files is required because MySQL can not properly handle
table
creation and constraint creation at
the same time. SO, I had to run eight different SQL command files in
order
to create all of the ActiveRBAC
tables, then create the seven ActiveRBAC constraints.

Also, this set of files creates a user “admin” with password “password”
who has the role “Admin”.

This will at least allow you to continue along in the ActiveRBAC
Manual’s
Articles example.

Of course, for your own application, you will have to change the
database
table name listed in every
rbac_mysql_X.sql file (where X=a, b, c, d, e, f, g, and h). Also, you
will
probably NOT need the database table
“articles” created at the beginning of the rbac_mysql_a.sql file.

Happy Programming!

John Wolfe

On 5/1/06, Keegan Govender wrote:
Hi there, I’ve installed the active_rbac engine and am following the
manual to install it. I’ve come to point 2.2.1 Installing Engines and
ActiveRBAC . When I try to execute the engines migration I get the
following error:

C:\Documents and Settings\Keegan\My Documents\Website
Work\live2move\code\L2M>rake db:migrate:engines --trace
(in C:/Documents and Settings/Keegan/My Documents/Website
Work/live2move/code/L2M)
** Invoke db:migrate:engines (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate:engines
Migrating engine ‘active_rbac’
== ImportActiveRbacSchema: migrating

rake aborted!
Invalid argument - /C:/Documents and Settings/Keegan/My
Documents/Website
Work/live2move/code/L2M/C:/Documents and Settings/Keegan/My
Documents/Website
Work/live2move/code/L2M/config/…/vendor/plugins/active_rbac/db/migrate
c:/ruby/lib/ruby/1.8/pathname.rb:341:in lstat' c:/ruby/lib/ruby/1.8/pathname.rb:341:inrealpath’
C:/Documents and Settings/Keegan/My Documents/Website
Work/live2move/code/L2M/config/…/vendor/plugins/active_rbac/db/migrate/001_import_active_rbac_schema.rb:6:in
real_up' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:209:inmigrate’
c:/ruby/lib/ruby/1.8/benchmark.rb:293:in measure' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:209:inmigrate’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:331:in
migrate' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:326:inmigrate’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-
1.14.0/lib/active_record/migration.rb:293:in up' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/migration.rb:284:inmigrate’
./vendor/plugins/engines/tasks/engines.rake:80
./vendor/plugins/engines/tasks/engines.rake:75
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:232:in execute' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:232:inexecute’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:202:in invoke' c:/ruby/lib/ruby/1.8/thread.rb:135:insynchronize’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:195:in invoke' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.0/lib/rake.rb:1719:inrun’
c:/ruby/lib/ruby/gems/1.8/gems/rake- 0.7.0/lib/rake.rb:1719:in `run’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.0/bin/rake:7
c:/ruby/bin/rake.bat:25

Do you have any ideas as to what the issue is and any suggestions on how
to go about fixing it.

Thanks, Keegan.