Ability to give a statement

This commit is contained in:
2017-04-13 17:16:03 +02:00
parent b30bd91f3d
commit dd5e22ea48
66 changed files with 812 additions and 25 deletions
+8 -16
View File
@@ -1,5 +1,11 @@
class Supporter
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Paranoia
include Geocoder::Model::Mongoid
COUNTER_START = 10_003
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
@@ -23,22 +29,6 @@ class Supporter
field :current_sign_in_ip, type: String
field :last_sign_in_ip, type: String
## Confirmable
# field :confirmation_token, type: String
# field :confirmed_at, type: Time
# field :confirmation_sent_at, type: Time
# field :unconfirmed_email, type: String # Only if using reconfirmable
## Lockable
# field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
# field :unlock_token, type: String # Only if unlock strategy is :email or :both
# field :locked_at, type: Time
include Mongoid::Timestamps
include Mongoid::Paranoia
include Geocoder::Model::Mongoid
COUNTER_START = 10_003
geocoded_by :address
after_validation :geocode # auto-fetch coordinates
@@ -66,6 +56,8 @@ class Supporter
validates :age_category, presence: true
validates :language, presence: true
embeds_one :publicity
def self.counter
actual = count.to_i
actual > COUNTER_START ? actual : COUNTER_START