Run code on application launch

I have some fields that set up a HABTM relationship (permissions for an
access control list for users) that need to pair user roles with
permissions, and I’d like to not have to set it up manually in the
database. Instead, I’d like to just say things like:

unless role.permissions.include?(“controller/action”)
role.permissions<<“controller/action”
end

This way I can change the permission structure from ruby, rather than
having to go to the DB. Also, DB schemas (eg for migrations) aren’t
going to carry my carefully selected table contents with them.

I only want to run this once, when the application starts. So, where do
I put this code?

Thanks,
Asa

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs