# Undefined method attr\_accessible

**URL:** <https://www.ruby-forum.com/t/undefined-method-attr-accessible/158562>\
**Category:** Rails\
**Created:** [January 24, 2009, 9:45pm UTC](https://www.ruby-forum.com/t/undefined-method-attr-accessible/158562 "2009-01-24T21:45:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [January 24, 2009, 9:45pm UTC](https://www.ruby-forum.com/t/undefined-method-attr-accessible/158562/1 "2009-01-24T21:45:05Z")

</div>

Hi,

I just created a new model called Sidebar, for custom sidebar on a per  
page basis:

–  
class Sidebar \< ActiveRecord::Base

attr\_accessibleÂ :content  
validates\_uniqueness\_of :permalink, :scope =\> :site\_id

## end # class Sidebar

## Here is the stack trace;

## /usr/local/ruby1.8.7/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/base.rb:1833:in `method_missing_without_paginate' /usr/local/ruby1.8.7/lib/ruby/gems/1.8/gems/mislav-will_paginate-2.3.6/lib/will_paginate/finder.rb:167:in`method\_missing’ app/models/sidebar.rb:3 app/controllers/pages\_controller.rb:18:in `faq’

## Inside my controller, I call:

## @sidebar = Sidebar.find\_by\_permalink\_and\_site\_id(‘faq’, @site.id)

But Rails doesn’t recognize the attr\_accessible method here, what could  
possibly go wrong? It’s the first time I run into this issue.

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [January 24, 2009, 9:51pm UTC](https://www.ruby-forum.com/t/undefined-method-attr-accessible/158562/2 "2009-01-24T21:51:12Z")

</div>

> But Rails doesn’t recognize the attr\_accessible method here, what could  
> possibly go wrong? It’s the first time I run into this issue.

Please disregard my post, it seems I had typed an invisible character in  
Textmate that messed up the method call. When I retyped the Model it  
worked.
