Addded default badge 'none' and enforced badges

This commit is contained in:
MrYummy
2017-06-02 18:26:48 +02:00
parent 7d3ad5cde6
commit 00254ebf51
2 changed files with 2 additions and 1 deletions

View File

@@ -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

View File

@@ -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