Add validations

This commit is contained in:
Erik Michaels-Ober 2011-05-22 07:27:36 -07:00
parent f11f8c789c
commit 6ded1e3bf3
2 changed files with 2 additions and 0 deletions

View File

@ -1,4 +1,5 @@
class Hydrant < ActiveRecord::Base class Hydrant < ActiveRecord::Base
validates_presence_of :lat, :lng
belongs_to :user belongs_to :user
def self.find_closest(lat, lng, limit=50) def self.find_closest(lat, lng, limit=50)

View File

@ -1,5 +1,6 @@
class User < ActiveRecord::Base class User < ActiveRecord::Base
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
attr_accessible :email, :name, :organization, :voice_number, :sms_number, :password, :password_confirmation, :remember_me attr_accessible :email, :name, :organization, :voice_number, :sms_number, :password, :password_confirmation, :remember_me
validates_presence_of :name
has_many :hydrants has_many :hydrants
end end