Add validations
This commit is contained in:
parent
f11f8c789c
commit
6ded1e3bf3
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue