RailsCasts Pro episodes are now free!

Learn more or hide this

Trevor Grayson's Profile

GitHub User: trevorgrayson

Site: http://trevorgrayson.com

Comments by Trevor Grayson

Avatar

is it just me, or does the question mark on the function name break this?

This works for me:
validates_presence_of :state, :if => :in_us
def in_us
  country == 'US'
end

This, would not:
validates_presence_of :state, :if => :in_us?
def in_us?
  country == 'US'
end