diff options
| author | Jerome Dalbert <jerome@rentify.com> | 2014-01-18 19:07:00 +0000 |
|---|---|---|
| committer | Jerome Dalbert <jerome@rentify.com> | 2014-01-18 19:15:10 +0000 |
| commit | 2e3f250d4516c92adce5511747419d7f1fe04b97 (patch) | |
| tree | bdf7a0dc744a55a3b96a10131baebd996e5b9d79 /app/models/user.rb | |
| parent | dba982403b7b894d2096ea61b89a247060eefe57 (diff) | |
| download | gitlab-ce-2e3f250d4516c92adce5511747419d7f1fe04b97.tar.gz | |
Add website url to user
Diffstat (limited to 'app/models/user.rb')
| -rw-r--r-- | app/models/user.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index f2cd554f9c3..3691b1d1eaa 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -41,7 +41,8 @@ # confirmed_at :datetime # confirmation_sent_at :datetime # unconfirmed_email :string(255) -# hide_no_ssh_key :boolean default(FALSE), not null +# hide_no_ssh_key :boolean default(FALSE) +# website_url :string(255) default(""), not null # require 'carrierwave/orm/activerecord' @@ -52,7 +53,7 @@ class User < ActiveRecord::Base :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :confirmable, :registerable attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username, - :skype, :linkedin, :twitter, :color_scheme_id, :theme_id, :force_random_password, + :skype, :linkedin, :twitter, :website_url, :color_scheme_id, :theme_id, :force_random_password, :extern_uid, :provider, :password_expires_at, :avatar, :hide_no_ssh_key, as: [:default, :admin] @@ -424,4 +425,14 @@ class User < ActiveRecord::Base order('id DESC').limit(1000). update_all(updated_at: Time.now) end + + def full_website_url + return "http://#{website_url}" if website_url !~ /^https?:\/\// + + website_url + end + + def short_website_url + website_url.gsub(/https?:\/\//, '') + end end |
