username is default param to User

This commit is contained in:
Andrey Kumanyaev 2013-01-25 22:35:58 +04:00
parent df64bdffdf
commit 916165dfc4
1 changed files with 5 additions and 0 deletions

View File

@ -143,6 +143,11 @@ class User < ActiveRecord::Base
#
# Instance methods
#
def to_param
username
end
def generate_password
if self.force_random_password
self.password = self.password_confirmation = Devise.friendly_token.first(8)