[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ActiveRecord acting weird

mark

1/20/2006 7:30:00 PM

I got this out of a book so I'm pretty sure it should work:

class Folder < ActiveRecord::Base
def validate
if self.find_by_name(name)
errors.add("folder by that name exists")
end
end
end

but when I validate:

<%
f = Folder.find_by_name("New Folder")
%>

<%= f.valid? %>

I get this:
undefined method `find_by_name' for #<Folder:0x40a125f4>

Any ideas?
Thanks