Can't grant permission to all of a class #5

Closed
crystalneth opened this Issue Mar 13, 2010 · 3 comments

Comments

Projects
None yet
2 participants
Contributor

crystalneth commented Mar 13, 2010

in sanctions.rb:

config.role :admin, User => Team

User.grant(:admin, Team)

Causes an exception because the following SQL was generated from this line. You can see it is expecting Team.id

vendor/plugins/sanction/app/models/sanction/role.rb:35:in `uniqueness_of_intent'

ActiveRecord::StatementInvalid: PGError: ERROR: invalid input syntax for integer: ""
: SELECT "sanction_roles".id FROM "sanction_roles" WHERE ((sanction_roles.principal_type = E'User' AND (sanction_roles.principal_id = E'' OR sanction_roles.principal_id IS NULL)) AND (sanction_roles.name = E'admin') AND (sanction_roles.permissionable_type = E'Team' AND (sanction_roles.permissionable_id = E'' OR sanction_roles.permissionable_id IS NULL))) LIMIT 1

Contributor

crystalneth commented Mar 13, 2010

The invalid sql is near the end:

sanction_roles.permissionable_id = E''

Contributor

crystalneth commented Mar 13, 2010

This was a postgresql problem. Fixed in commit 442b1a7

Owner

matthewvermaak commented Mar 13, 2010

Thanks, its merged into master, and will mitigate to 1-1-stable soon.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment