# ActiveRecord::Validation#valid? throws strange ArgumentError

**URL:** <https://www.ruby-forum.com/t/activerecord-validation-valid-throws-strange-argumenterror/85220>\
**Category:** Rails\
**Created:** [February 11, 2007, 5:37pm UTC](https://www.ruby-forum.com/t/activerecord-validation-valid-throws-strange-argumenterror/85220 "2007-02-11T17:37:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yetanothergeek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/8e8cbc/32.png) [@yetanothergeek](https://www.ruby-forum.com/u/yetanothergeek)\
**Post date:** [February 11, 2007, 5:37pm UTC](https://www.ruby-forum.com/t/activerecord-validation-valid-throws-strange-argumenterror/85220/1 "2007-02-11T17:37:26Z")

</div>

I’m running Rails 1.2.1 with Ruby 1.8.4. The following script/console  
session reveals the problem one of my models is suffering:

> > r=Reminder.new  
> > =\> #\<Reminder:0xb73cf3d4 @new\_record=true,  
> > @attributes={“receiver\_id”=\>nil, “sent\_date”=\>nil, “appt\_date”=\>nil,  
> > “notify”=\>nil}\>
> 
> > r.valid?  
> > ArgumentError: wrong number of arguments (1 for 0)  
> > from  
> > /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active\_record/callbacks.rb:328:in  
> > `notify' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/callbacks.rb:328:in`callback’  
> > from  
> > /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active\_record/callbacks.rb:301:in  
> > `valid?’  
> > from (irb):2

Here is my model:

class Reminder \< ActiveRecord::Base  
belongs\_to(:receiver)

validates\_presence\_of(:appt\_date)  
validates\_numericality\_of(:notify)  
validates\_presence\_of(:receiver\_id)  
end

Here is my migration:

def self.up  
create\_table :reminders do |t|  
t.column(:appt\_date, :datetime, :null =\> false)  
t.column(:notify, :integer, :null =\> false)  
t.column(:sent\_date, :datetime)  
t.column(:receiver\_id, :integer, :null =\> false)  
end

```
add_index(:reminders, :receiver_id)

```

end

What gives? `r.valid?` should return false. I have similar, more complex  
setups with other models using validates\_presence\_of and  
validates\_numericality\_of and they do not throw ArgumentErrors. As  
expected, if I comment out the validates\_\* method calls the problem goes  
away.

Any help is greatly appreciated! Thanks in advance 😉

---

<div class="post-metadata">

**Author:** ![yetanothergeek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/8e8cbc/32.png) [@yetanothergeek](https://www.ruby-forum.com/u/yetanothergeek)\
**Post date:** [February 12, 2007, 1:25pm UTC](https://www.ruby-forum.com/t/activerecord-validation-valid-throws-strange-argumenterror/85220/2 "2007-02-12T13:25:56Z")

</div>

On 2/12/07, Chris S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ArgumentError: wrong number of arguments (1 for 0)  
> from  
> /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active\_record/callbacks.rb:328:in  
> `notify’  
> …

Ouch! callbacks.rb:328 shows that #notify is an internally used  
private method. Your notify attribute is colliding with this. Try  
choosing another name (as unsatisfying as that solution probably  
seems…).
