MySQL Forums
Forum List  »  Ruby

Re: MYSQL and RoR
Posted by: Frank Mash
Date: March 23, 2006 09:41PM

Hello Rafael,

This is very do-able in Rails.

What you will need to do is something like:

Create models to hold your positions and permissions.

Then setup HABTM relationships using has_and_belongs_to_many
For Member class:
has_and_belongs_to_many :positions

For Position class:
has_and_belongs_to_many :members
has_and_belongs_to_many :permissions


For Permission class:
has_and_belongs_to_many :positions

Then create tables:
positions_users, positions, permissions_positions, permissions

Then setup:
function to be executed before actions where permissions check is required using before_filter where you actually check for permissions. In that function you will query the positions table and then check for permissions.

Hope this helps.


-- Frank

Upcoming books:
Pro Rails and Pro Server Management

Come attend my Applied ROR session in the MySQL UC.

My Grande RSS Feed (ROR + MySQL + Linux)
http://feedshake.com/mpfeeds/gk4zwwligo.xml

My blogs:
http://railsruby.blogspot.com
http://mysqldatabaseadministration.blogspot.com

Options: ReplyQuote


Subject
Written By
Posted
January 19, 2006 07:13PM
February 07, 2006 01:40AM
Re: MYSQL and RoR
March 23, 2006 09:41PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.