parent
9655df14a9
commit
826c88f157
|
@ -31,9 +31,7 @@ class User < ActiveRecord::Base
|
|||
:through => :votes,
|
||||
:source => :story
|
||||
has_many :hats
|
||||
has_many :wearable_hats,
|
||||
-> { where('hats.doffed_at' => nil) },
|
||||
:class_name => "Hat"
|
||||
has_many :wearable_hats, -> { where('doffed_at is null') }, :class_name => "Hat"
|
||||
|
||||
has_secure_password
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
class FixDoffedAt < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
change_column_default :hats, :doffed_at, nil
|
||||
Hat.where("doffed_at = ?", "0000-00-00 00:00:00").update_all(:doffed_at => nil)
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20180131170318) do
|
||||
ActiveRecord::Schema.define(version: 20180131203555) do
|
||||
|
||||
create_table "comments", id: :integer, unsigned: true, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" do |t|
|
||||
t.datetime "created_at", null: false
|
||||
|
|
Loading…
Reference in New Issue