मैं रेल के साथ रेल 5 एपीआई का उपयोग कर रहा हूं। मेरे पास User
मॉडल है। स्कीमा इस तरह दिखता है।रेल 5 मॉडल ऑब्जेक्ट्स सभी डेविस विशेषताओं को प्रदर्शित नहीं कर रहे हैं
create_table "users", force: :cascade do |t|
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.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
end
लेकिन मुद्दा मैं कर रहा हूँ रेल केवल मॉडल के भाग के रूप :id , :email , :created_at , :updated_at
गुण दिखा है। उदाहरण के लिए, रेल कंसोल
User.new
=> #<User id: nil, email: "", created_at: nil, updated_at: nil>
User.first
User Load (0.5ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT $1 [["LIMIT", 1]]
=> #<User id: 2, email: "[email protected]", created_at: "2016-09-22 03:58:04", updated_at: "2016-09-22 04:54:41">
लेकिन ये गुण डेटाबेस में मौजूद हैं। इस समस्या का पहले उल्लेख किया गया है। Devise with rails 5। लेकिन वहां कोई जवाब नहीं है। कृपया मदद करें।
'user.first.to_json' –