User: username regex is a const now
This commit is contained in:
parent
0c1516bb14
commit
b4f0f57df9
|
@ -95,10 +95,8 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def self.username_regex
|
||||
User.validators_on(:username).select{|v|
|
||||
v.class == ActiveModel::Validations::FormatValidator }.first.
|
||||
options[:with].inspect
|
||||
def self.username_regex_s
|
||||
"/^" + VALID_USERNAME.to_s.gsub(/(\?-mix:|\(|\))/, "") + "$/"
|
||||
end
|
||||
|
||||
def as_json(options = {})
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<%= f.label :username, t('.username'), :class => "required" %>
|
||||
<%= f.text_field :username, :size => 15 %>
|
||||
<span class="hint">
|
||||
<tt><%= User.username_regex %></tt>
|
||||
<tt><%= User.username_regex_s %></tt>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<%= f.label :username, "Username:", :class => "required" %>
|
||||
<%= f.text_field :username, :size => 30 %>
|
||||
<span class="hint">
|
||||
<tt><%= User.username_regex %></tt>
|
||||
<tt><%= User.username_regex_s %></tt>
|
||||
</span>
|
||||
<br />
|
||||
|
||||
|
|
Loading…
Reference in a new issue