added profile_picture to users
This commit is contained in:
parent
f5917277fa
commit
cf3933271a
|
@ -40,6 +40,9 @@ class User < ActiveRecord::Base
|
|||
|
||||
# validates :website, format: { with: WEBSITE_REGEX }
|
||||
|
||||
has_attached_file :profile_picture, styles: { medium: "256x256>", thumb: "80x80>" }, default_url: "/images/:style/no_avatar.png"
|
||||
validates_attachment_content_type :profile_picture, :content_type => /\Aimage\/.*\Z/
|
||||
|
||||
before_save do
|
||||
self.display_name = 'WRYYYYYYYY' if display_name == 'Dio Brando'
|
||||
self.website = if website.match %r{\Ahttps?://}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
class AddAttachmentProfilePictureToUsers < ActiveRecord::Migration
|
||||
def self.up
|
||||
change_table :users do |t|
|
||||
t.attachment :profile_picture
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_attachment :users, :profile_picture
|
||||
end
|
||||
end
|
36
db/schema.rb
36
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20141228202825) do
|
||||
ActiveRecord::Schema.define(version: 20141229085904) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -133,12 +133,12 @@ ActiveRecord::Schema.define(version: 20141228202825) do
|
|||
add_index "smiles", ["user_id"], name: "index_smiles_on_user_id", using: :btree
|
||||
|
||||
create_table "users", force: true do |t|
|
||||
t.string "email", default: "", null: false
|
||||
t.string "encrypted_password", default: "", null: false
|
||||
t.string "email", default: "", null: false
|
||||
t.string "encrypted_password", default: "", null: false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.datetime "remember_created_at"
|
||||
t.integer "sign_in_count", default: 0, null: false
|
||||
t.integer "sign_in_count", default: 0, null: false
|
||||
t.datetime "current_sign_in_at"
|
||||
t.datetime "last_sign_in_at"
|
||||
t.string "current_sign_in_ip"
|
||||
|
@ -146,19 +146,23 @@ ActiveRecord::Schema.define(version: 20141228202825) do
|
|||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "screen_name"
|
||||
t.integer "friend_count", default: 0, null: false
|
||||
t.integer "follower_count", default: 0, null: false
|
||||
t.integer "asked_count", default: 0, null: false
|
||||
t.integer "answered_count", default: 0, null: false
|
||||
t.integer "commented_count", default: 0, null: false
|
||||
t.integer "friend_count", default: 0, null: false
|
||||
t.integer "follower_count", default: 0, null: false
|
||||
t.integer "asked_count", default: 0, null: false
|
||||
t.integer "answered_count", default: 0, null: false
|
||||
t.integer "commented_count", default: 0, null: false
|
||||
t.string "display_name"
|
||||
t.integer "smiled_count", default: 0, null: false
|
||||
t.boolean "admin", default: false, null: false
|
||||
t.string "motivation_header", default: "", null: false
|
||||
t.string "website", default: "", null: false
|
||||
t.string "location", default: "", null: false
|
||||
t.text "bio", default: "", null: false
|
||||
t.boolean "moderator", default: false, null: false
|
||||
t.integer "smiled_count", default: 0, null: false
|
||||
t.boolean "admin", default: false, null: false
|
||||
t.string "motivation_header", default: "", null: false
|
||||
t.string "website", default: "", null: false
|
||||
t.string "location", default: "", null: false
|
||||
t.text "bio", default: "", null: false
|
||||
t.boolean "moderator", default: false, null: false
|
||||
t.string "profile_picture_file_name"
|
||||
t.string "profile_picture_content_type"
|
||||
t.integer "profile_picture_file_size"
|
||||
t.datetime "profile_picture_updated_at"
|
||||
end
|
||||
|
||||
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
|
||||
|
|
Loading…
Reference in New Issue