I don't see anything wrong with this.  I'd only resort to a filter if
it was going to be used by multiple actions.

On Feb 25, 11:02 am, Vahagn Hayrapetyan <rails-mailing-l...@andreas-
s.net> wrote:
> Sorry, the code should have been:
>
>  def destroy
>     @user = User.find(params[:id])
>     if @user == logged_in_user or
> logged_in_user.has_role?('administrator')
>       if @user.destroy
>         flash[:notice] = "User deleted"
>       else
>         flash[:error] = "There was a problem deleting this user."
>       end
>       redirect_to :action => 'index'
>     end
>   end
>
> / V.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to