# Trouble overriding default accessor/mutator

**URL:** <https://www.ruby-forum.com/t/trouble-overriding-default-accessor-mutator/120595>\
**Category:** Rails\
**Created:** [November 19, 2007, 12:37am UTC](https://www.ruby-forum.com/t/trouble-overriding-default-accessor-mutator/120595 "2007-11-19T00:37:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mojojojo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@mojojojo](https://www.ruby-forum.com/u/mojojojo)\
**Post date:** [November 19, 2007, 12:37am UTC](https://www.ruby-forum.com/t/trouble-overriding-default-accessor-mutator/120595/1 "2007-11-19T00:37:40Z")

</div>

I have a database column storing a duration value as a number of  
seconds, but I’d like users to be able to see it and edit it as a time  
value. I am trying to override the default accessor/mutator for the  
attribute and do the conversions there, using something that looks  
like:

def duration  
Time.at(self[:duration].to\_i).getutc  
end

def duration=(value)  
self[:duration] = value.to\_i  
end

Everything seems OK, but when I go to save the record, I get the  
following:

ActiveRecord::MultiparameterAssignmentErrors in  
AdminController#update

1 error(s) on assignment of multiparameter attributes

What am I missing?
