Je suis en train d'initialiser un nouvel utilisateur dans la console rails de mon application. Chaque fois que j'entrer le code d'initialisation:rails 5 (L'objet ne prend pas en charge #inspect) lors de l'utilisation de la console rails
irb(main):001:0> user = User.new
-je obtenir cette erreur:
(Object doesn't support #inspect)
=>
irb(main):002:0>
Je les informations d'identification utilisateur mis en place correctement, et il n'y a pas d'utilisation du code de la mauvaise façon.
class User
include Mongoid::Document
# User fields
field :first_name, type: String
field :last_name, type: String
field :phone_number, type: Integer
field :address, type: String
field :info, type: String
field :portfolio, type: String
field :motto, type: String
field :cover, type: BSON::Binary
field :avatar, type: BSON::Binary
field :photo, type: BSON::Binary
field :request, type: Boolean
field :decision, type: Boolean
field :gender, type: String
field :user_url, type: Mongoid::EncryptedHash
field :position, type: String
field :created_at, type: DateTime, default: ->{DateTime.now}
field :updated_at, type: DateTime
field :view_comments_count, type: Integer
field :thumbs_up_notifications, type: Boolean
field :tracking_notifications, type: Boolean
field :message_notifications, type: Boolean
field :applaud_notifications, type: Boolean
field :shout_out_notifications, type: Boolean
field :congrats_notifications, type: Boolean
field :post_notifications, type: Boolean
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
## Database authenticatable
field :email, type: String, default: ""
field :password, type: Mongoid::EncryptedString, default: ""
## Recoverable
field :reset_password_token, type: Mongoid::EncryptedString
field :reset_password_sent_at, type: Time
## Rememberable
field :remember_created_at, type: Time
## Trackable
field :sign_in_count, type: Integer, default: 0
field :current_sign_in_at, type: Time
field :last_sign_in_at, type: Time
field :current_sign_in_ip, type: String
field :last_sign_in_ip, type: String
## Confirmable
field :confirmation_token, type: String
field :confirmed_at, type: Time
field :confirmation_sent_at, type: Time
field :unconfirmed_email, type: String # Only if using reconfirmable
## Lockable
field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
field :unlock_token, type: String # Only if unlock strategy is :email or :both
field :locked_at, type: Time
attr_accessor :verify_password, :password_confirmation
attr_reader :comment_notifications, :post_notifications,
:shout_out_notifications, :thumbs_up_notifications,
:applaud_notifications, :tracking_notifications,
:congrats_notifications, :message_notifications,
:request_notifications, :acceptance_notifications
validates :first_name, presence: true
validates :last_name, presence: true
validates :email, presence: true
validates :password, presence: true
validates :phone_number, presence: true
validates :address, presence: true
validates :info, presence: true
validates :motto, presence: true
validates :gender, presence: true
validates_confirmation_of :password
has_many :posts
has_many :comments
has_many :thumbs_ups
has_many :congrats
has_many :tracks
has_many :shout_outs
has_many :applauds
has_many :assignments
has_one :position
has_one :rank
belongs_to :group
after_create :find_default_contacts, :create_url
before_save :validates_email, :validates_motto, :validates_info
Si quelqu'un pouvait préciser ce qui cause l'erreur, je l'apprécierais.
pouvez-vous me montrer votre fichier de migration pour les utilisateurs .. il suffit de copier et coller à partir du schéma? –
J'utilise une base de données NoSQL: MongoDB. Il n'y a pas de migrations. – metaco57
pourriez-vous coller le code user.rb complet et votre gemfile s'il vous plaît? –