noosfero | Custom roles management (#514)

Rodrigo Souto gitlab at gitlab.com
Wed May 6 19:22:22 BRT 2015


New comment for Merge Request 514

https://gitlab.com/noosfero/noosfero/merge_requests/514#note_1198709


Rodrigo Souto

It's not a good practice to assume the last role is the role you just created due to triggers and databases inner logics. Instead of `Role.last`, fetch the role explicitly like `Role.where(:name => 'some_role')`. Also you should ensure that it doesn't exist before the post request. Then after the post you can assert it exists instead of checking it's name

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150506/df6c98f7/attachment.html>


More information about the Noosfero-dev mailing list