I don't have all the context of your application but they way I understood, if the role is not updated for some reason, the user will get notified that they have a super power when they not. You should move the check after the role is updated.
Also it's worth the mention that attr_acccessor (Ruby method apidock.com/ruby/Module/attr_accessor) acts as an alias for attr_reader and attr_writer methods, both options will work for this case.
I don't have all the context of your application but they way I understood, if the role is not updated for some reason, the user will get notified that they have a super power when they not. You should move the check after the role is updated.
Also it's worth the mention that attr_acccessor (Ruby method apidock.com/ruby/Module/attr_accessor) acts as an alias for attr_reader and attr_writer methods, both options will work for this case.
Examples:
Hope this makes it clear, since the line about why you use attr_accessor can be misleading.
Good writing, thanks for sharing.
Gotcha, thanks for that. I updated my article to clarify my point.
And yeah, good point about the email sending even if the role is not properly updated.
Thanks for reading!