# Please help: "undefined method 'updated?'"

**URL:** <https://www.ruby-forum.com/t/please-help-undefined-method-updated/55051>\
**Category:** Rails\
**Created:** [March 16, 2006, 5:47pm UTC](https://www.ruby-forum.com/t/please-help-undefined-method-updated/55051 "2006-03-16T17:47:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_SSiso-8859-1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c4cdca/32.png) [@Peter\_SSiso-8859-1](https://www.ruby-forum.com/u/Peter_SSiso-8859-1)\
**Post date:** [March 16, 2006, 5:47pm UTC](https://www.ruby-forum.com/t/please-help-undefined-method-updated/55051/1 "2006-03-16T17:47:31Z")

</div>

Hi,

after updating to rails1.0 (using the debian package) and following the  
instructions at [Peak Obsession](http://manuals.rubyonrails.com/read/chapter/120)  
I always get in my rails application the following error:  
“undefined method `updated?’ for #Device:0xb6c95564”  
when I want to save (create or update) an interface or device-object  
(as explanation: devices are servers, which have many interfaces).

Thank you in advance for your help to find my mistake!

Kind Regards  
Peter

My relevant code snippets are:  
------------------- models/device.rb ---------------------  
class Device \< ActiveRecord::Base  
belongs\_to :devicetype  
belongs\_to :devicemodel  
belongs\_to :cabinet  
has\_many :interfaces  
has\_and\_belongs\_to\_many :groups  
validates\_presence\_of :name, :he  
validates\_uniqueness\_of :name  
validates\_numericality\_of :he  
[…]  
end

------------------- models/device.rb ---------------------  
class Interface \< ActiveRecord::Base  
belongs\_to :device  
belongs\_to :cable  
belongs\_to :patchcable  
validates\_presence\_of :name, :device\_id  
[…]  
end

## I want to add a comment to an existing interface, so here’s the update method: ------------------- controllers/interfaces\_controller.rb

[…]  
def update  
@interface = Interface.find(params[:id])  
unless @interface.device.is\_writable(@logged\_user)  
flash[:error] = ‘Keine Berechtigung!’  
redirect\_to :action =\> ‘show’, :id =\> @interface.id  
else  
if params[:interface][:upstream] != “1”  
params[:interface][:upstream] = ‘’  
end  
if @interface.update\_attributes(params[:interface])  
flash[:notice] = ‘Schnittstelle wurde aktualisiert.’  
redirect\_to :action =\> ‘show’, :id =\> @interface  
else  
render :action =\> ‘edit’  
end  
end  
end  
[…]

An interface object consists of name and comment and has relations to a  
server  
and a cable (and sometimes to an extra patchcable).

The error message I get is:  
NoMethodError in Interfaces#update  
undefined method `updated?’ for #Device:0xb6c95564  
RAILS\_ROOT: […]  
(Full Trace, “#{RAILS\_ROOT}” removed to get rid of some line breaks…)

/vendor/rails/activerecord/lib/active\_record/base.rb:1498:in  
`method_missing' /vendor/rails/activerecord/lib/active_record/callbacks.rb:341:in `callback’  
/vendor/rails/activerecord/lib/active\_record/callbacks.rb:335:in  
`callback' /vendor/rails/activerecord/lib/active_record/callbacks.rb:330:in `each’  
/vendor/rails/activerecord/lib/active\_record/callbacks.rb:330:in  
`callback' /vendor/rails/activerecord/lib/active_record/callbacks.rb:248:in `create\_or\_update’  
/vendor/rails/activerecord/lib/active\_record/base.rb:1226:in  
`save_without_validation' /vendor/rails/activerecord/lib/active_record/validations.rb:698:in `save\_without\_transactions’  
/vendor/rails/activerecord/lib/active\_record/transactions.rb:126:in  
`save' /vendor/rails/activerecord/lib/active_record/transactions.rb:126:in `transaction’  
/vendor/rails/activerecord/lib/active\_record/transactions.rb:91:in  
`transaction' /vendor/rails/activerecord/lib/active_record/transactions.rb:118:in `transaction’  
/vendor/rails/activerecord/lib/active\_record/transactions.rb:126:in  
`save' /vendor/rails/activerecord/lib/active_record/base.rb:1267:in `update\_attributes’  
/app/controllers/interfaces\_controller.rb:102:in `update' /vendor/rails/actionpack/lib/action_controller/base.rb:853:in `perform\_action\_without\_filters’  
/vendor/rails/actionpack/lib/action\_controller/filters.rb:332:in  
`perform_action_without_benchmark' /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform\_action\_without\_rescue’  
/vendor/rails/actionpack/lib/action\_controller/benchmarking.rb:69:in  
`measure' /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform\_action\_without\_rescue’  
/vendor/rails/actionpack/lib/action\_controller/rescue.rb:82:in  
`perform_action' /vendor/rails/actionpack/lib/action_controller/base.rb:369:in `process\_without\_session\_management\_support’  
/vendor/rails/actionpack/lib/action\_controller/session\_management.rb:116:in  
`process' /vendor/rails/railties/lib/dispatcher.rb:38:in `dispatch’  
/var/www/ccm-psaenger.ncc.eurodata.de\_8080/public/dispatch.cgi:12

---

<div class="post-metadata">

**Author:** ![Peter\_SSiso-8859-1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c4cdca/32.png) [@Peter\_SSiso-8859-1](https://www.ruby-forum.com/u/Peter_SSiso-8859-1)\
**Post date:** [March 17, 2006, 4:36am UTC](https://www.ruby-forum.com/t/please-help-undefined-method-updated/55051/2 "2006-03-17T04:36:34Z")

</div>

Peter Sänger wrote:

> after updating to rails1.0 (using the debian package) and following the  
> instructions at [Peak Obsession](http://manuals.rubyonrails.com/read/chapter/120)  
> I always get in my rails application the following error:  
> “undefined method `updated?’ for #Device:0xb6c95564”

You may like to contact the author of this message, who  
had the same problem:

[http://article.gmane.org/gmane.comp.lang.ruby.rails/37392](http://article.gmane.org/gmane.comp.lang.ruby.rails/37392)

–  
We develop, watch us RoR, in numbers too big to ignore.

---

<div class="post-metadata">

**Author:** ![Peter\_SSiso-8859-1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c4cdca/32.png) [@Peter\_SSiso-8859-1](https://www.ruby-forum.com/u/Peter_SSiso-8859-1)\
**Post date:** [March 20, 2006, 12:01pm UTC](https://www.ruby-forum.com/t/please-help-undefined-method-updated/55051/3 "2006-03-20T12:01:52Z")

</div>

Hi,

thanks to Marshalls help, I figured out, that my problem was caused by a  
badly  
chosen name of a variable in the validates method of my interface model.  
Originally I called it @device, after renaming it the error was gone.

Thanks  
Peter
