Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

Commit

Permalink
Add time_zone column to users
Browse files Browse the repository at this point in the history
  • Loading branch information
allenwq committed Oct 14, 2015
1 parent 184ac2e commit 8f22df8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ class User < ActiveRecord::Base
attr_accessible :display_name, :name, :profile_photo_url
attr_accessible :provider, :uid
attr_accessible :use_uploaded_picture
attr_accessible :time_zone

protected_attributes :system_role_id

validates :name, presence: true
validates_inclusion_of :time_zone, in: ActiveSupport::TimeZone.zones_map(&:name)

before_update :send_out_notification_email, :if => :email_changed?
after_update :update_user_course, :if => :name_changed?

Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20151014153816_add_time_zone_to_users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddTimeZoneToUsers < ActiveRecord::Migration
def change
add_column :users, :time_zone, :string
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20151011115753) do
ActiveRecord::Schema.define(:version => 20151014153816) do

create_table "achievements", :force => true do |t|
t.string "icon_url"
Expand Down Expand Up @@ -1663,6 +1663,7 @@
t.boolean "is_pending_deletion", :default => false
t.boolean "use_uploaded_picture", :default => false
t.integer "fb_publish_actions_request_count", :limit => 1, :default => 0, :null => false
t.string "time_zone"
end

add_index "users", ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true
Expand Down

0 comments on commit 8f22df8

Please sign in to comment.