# In\_place\_edit\_for and nil objects

**URL:** <https://www.ruby-forum.com/t/in-place-edit-for-and-nil-objects/115457>\
**Category:** Rails\
**Created:** [September 25, 2007, 3:22pm UTC](https://www.ruby-forum.com/t/in-place-edit-for-and-nil-objects/115457 "2007-09-25T15:22:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![milo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@milo](https://www.ruby-forum.com/u/milo)\
**Post date:** [September 25, 2007, 3:22pm UTC](https://www.ruby-forum.com/t/in-place-edit-for-and-nil-objects/115457/1 "2007-09-25T15:22:21Z")

</div>

I have a setup with an admin\_controller that allows the editing of  
details for users on the site with a manage\_user method. This I have set  
up to use in-place editing in the same manner as “Rails Recipes.”, also  
including the in-place editing validation described here:  
[http://www.ruby-forum.com/topic/60342#new](http://www.ruby-forum.com/topic/60342#new)

When trying to update a user record, an error pops up and the following  
appears in the development log:

Processing AdminController#set\_user\_name (for 127.0.0.1 at 2007-09-25  
14:06:44) [POST]  
Session ID: 0c4a9ab51fa6851c042e1fb38d317b3c  
Parameters: {“action”=\>“set\_user\_name”, “id”=\>“1”,  
“controller”=\>“admin”, “value”=\>“Joe U…”}  
NoMethodError (You have a nil object when you didn’t expect it!  
You might have expected an instance of Array.  
The error occurred while evaluating nil.+):  
/usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active\_record/locking/optimistic.rb:64:in  
`update_without_callbacks' /usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/callbacks.rb:267:in `update\_without\_timestamps’

…and so on.  
I have attached the rest in case they are of use.

Does anyone have any ideas as to where I should be looking for the cause  
of this?

---

<div class="post-metadata">

**Author:** ![milo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@milo](https://www.ruby-forum.com/u/milo)\
**Post date:** [September 27, 2007, 11:52am UTC](https://www.ruby-forum.com/t/in-place-edit-for-and-nil-objects/115457/2 "2007-09-27T11:52:37Z")

</div>

Milo T. wrote:

> When trying to update a user record, an error pops up…

In case anyone was wondering, my users table had an lock\_version int  
column in it. Removing this fixed the problem.
