Archived
Addded default badge 'none' and enforced badges
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@ class User < ActiveRecord::Base
|
|||||||
|
|
||||||
has_secure_password
|
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 :password, :password_confirmation, :email_token, on: :create
|
||||||
validates_presence_of :name, :email, :ign
|
validates_presence_of :name, :email, :ign
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ class AddBadgeIdToUsers < ActiveRecord::Migration
|
|||||||
t.string "color"
|
t.string "color"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Badge.create!({name: "none", symbol: "", color: "#000"})
|
||||||
dbadge = Badge.create!({name: "donor", symbol: "$", color: "#f60"})
|
dbadge = Badge.create!({name: "donor", symbol: "$", color: "#f60"})
|
||||||
|
|
||||||
add_column :users, :badge_id, :integer, default: 0
|
add_column :users, :badge_id, :integer, default: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user