Velocity Reviews

Velocity Reviews (
-   Ruby (
-   -   ActiveRecord acting weird (

mark 01-20-2006 07:29 PM

ActiveRecord acting weird
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")

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?

All times are GMT. The time now is 12:39 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.