summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMrYummy <elemental428@gmail.com>2017-06-02 18:26:48 +0200
committerMrYummy <elemental428@gmail.com>2017-06-18 13:11:36 -0400
commit1e267a64fbca2668b3666984212d7e54b7160edd (patch)
treeff23b666195c365a432c8f33faeed065eca61be8
parent9837f12b595cbd783e835f93dd995f83b68e6749 (diff)
Addded default badge 'none' and enforced badges
-rw-r--r--app/models/user.rb2
-rw-r--r--db/migrate/20170319193517_add_badge_id_to_users.rb1
2 files changed, 2 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 24e7a2d..52b7130 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -9,7 +9,7 @@ class User < ActiveRecord::Base
has_secure_password
- before_validation :strip_whitespaces, :set_uuid, :set_name, :set_email_token, :set_role
+ before_validation :strip_whitespaces, :set_uuid, :set_name, :set_email_token, :set_role, :set_badge
validates_presence_of :password, :password_confirmation, :email_token, on: :create
validates_presence_of :name, :email, :ign
diff --git a/db/migrate/20170319193517_add_badge_id_to_users.rb b/db/migrate/20170319193517_add_badge_id_to_users.rb
index 4e9d7ed..19b58de 100644
--- a/db/migrate/20170319193517_add_badge_id_to_users.rb
+++ b/db/migrate/20170319193517_add_badge_id_to_users.rb
@@ -7,6 +7,7 @@ class AddBadgeIdToUsers < ActiveRecord::Migration
t.string "color"
end
+ Badge.create!({name: "none", symbol: "", color: "#000"})
dbadge = Badge.create!({name: "donor", symbol: "$", color: "#f60"})
add_column :users, :badge_id, :integer, default: 0