destroy_permitted? not working with a new database
35 views
Skip to first unread message
tomkins
unread,
Aug 22, 2012, 9:29:31 AM8/22/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to hobo...@googlegroups.com
I uploaded a different database that has the same structure but different data than the old database, and the remove button in a table has stopped working. It removes the item from the table but when I refresh the page it returns. I looked into the logs and I can see Hobo: Permission Denied!
This is my destroy_permitted? function:
def destroy_permitted?
acting_user == user or acting_user.administrator?
end
When I change the acting user to administrator it works, but when the acting user == user it gives Permission Denied, which it did not do with the old database.
Thanks.
tomkins
unread,
Aug 22, 2012, 9:45:59 AM8/22/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to hobo...@googlegroups.com
I forgot to mention, I have a table called access-roles that contains the rights for each type of user, and that data hasn't changed, only the data in the other tables.
Bryan Larsen
unread,
Aug 23, 2012, 1:58:15 PM8/23/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to hobo...@googlegroups.com
I prefer to use acting_user.id == user.id instead of acting_user ==
user. The way that rails works it isn't necessarily guaranteed that
two elements that occupy the same row in the database necessarily end
up instantiated as the same object, especially since acting_user may
have come from your session instead of the database.