Ruby on Rails Tuesday, March 4, 2014

You can use a before_action filter in the controller to check both the current user's permissions and the user he is about to delete. 

And if it is another admin user or himself, then redirect them to another page with a flash error message. More details at the filter link below 


Thanks,
Ganesh


On Wed, Mar 5, 2014 at 12:37 AM, Zainab Mohamed <lists@ruby-forum.com> wrote:
Hello,

I am a second year undergrad designing a ruby on rail program for
wedding.

I am struggling so much with lots of code but one main thing which I
don't understand how to do is to make sure that if the administrator has
the rights to delete any registered users, then they don't delete their
own account in the process, as is currently the case.

Please can someone help me? I know it is a code within user
controller.rb which has "def destroy" but I don't know how to go about
doing that.

Thank you

Zainab Mohamed

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5e1541e64d742fbc8d53eaf8aa1e547c%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CALFmRoHTgi5KgJnuCCHLnxvqn%3DDxSToc2_WGVUyi4z9xmTTOCQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment