# acts\_as\_authenticated and model related.

**URL:** <https://discuss.rubyonrails.org/t/acts-as-authenticated-and-model-related/8277>\
**Category:** rubyonrails-talk\
**Created:** [February 6, 2007, 4:48pm UTC](https://discuss.rubyonrails.org/t/acts-as-authenticated-and-model-related/8277 "2007-02-06T16:48:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rick\_Olson](https://avatars.discourse-cdn.com/v4/letter/r/898d66/32.png) [@Rick\_Olson](https://discuss.rubyonrails.org/u/Rick_Olson)\
**Post date:** [February 6, 2007, 4:48pm UTC](https://discuss.rubyonrails.org/t/acts-as-authenticated-and-model-related/8277/1 "2007-02-06T16:48:34Z")

</div>

Check the authorization in a before filter in your controllers. AAA provides #authorized? as a hook for this.

before\_filter :login\_required, :only =\> [:new, :create, :update, :edit, :destroy]

def authorized? &nbsp;&nbsp;@item.editable\_by? current\_user end

class Item \< AR::Base &nbsp;&nbsp;def editable\_by?(user) &nbsp;&nbsp;&nbsp;&nbsp;user && user.id == user\_id # sample, replace with your own logic &nbsp;&nbsp;end end
