just being showed this yesterday, and I just noticed even it's cooler
from its doc

file:///Users/arie/manuals/index.html?a=M001629&name=validate

oops, just refer to the fastest ajax rails doc at http://railsbrain.com

validate(*methods, &block)

class Comment < ActiveRecord::Base
    validate :must_be_friends

    def must_be_friends
      errors.add_to_base("Must be friends to leave a comment") unless
commenter.friend_of?(commentee)
    end
  end

it supports yield, that's a relief, instead of doing it the old way
protected def validate then errors.add blah blah blah was not that
convenient, eh?!

-- 
r9 = { name: Rie!, ym: riyari3, skype: rubyninja,
li: http://linkedin.com/in/ariekeren,
fb: http://profile.to/ariekeren,
blog: http://tinyurl.com/2bjgvn }

Kirim email ke