Ich habe diesen Fehler: Errno::ENOENT in PicturethingsController#update_profile
.Rails aktive Datensatzduplizierung und Sicherungsfehler
No such file or directory - /Users/Baz/rails/myapp/public/uploads/picturething/picture/49/cat.jpg
Ich versuche, die standardpicture aufzeichnen und speichern, das zu @ character.profilepicture zu duplizieren. Ich kann auch nicht @ character.profilepicture in der Datenbank speichern (ich weiß von der Überprüfung nach Eingabe der Rails-Konsole). Hier
ist die säumige Methode:
picturethings_controller.rb:
def update_profile
@character = Character.find_by(callsign: params[:callsign])
standardpicture = Picturething.find_by(id: params[:picid])
@character.build_profilepicture
@character.profilepicture.save!
@character.profilepicture = standardpicture.dup
@character.profilepicture.save!
@character.profilepicture.picture.recreate_versions!
@character.profilepicture.picture = @character.profilepicture.picture.profile
respond_to do |format|
format.html do
redirect_to @character.sociable
end
format.js
end
end
character.rb:
has_many :standardpictures, class_name: "Picturething",
inverse_of: :character,
foreign_key: "character_standard_id",
dependent: :destroy
has_one :profilepicture, class_name: "Picturething",
inverse_of: :character,
foreign_key: "character_profile_id",
dependent: :destroy
picturething.rb:
mount_uploader :picture, CharacterpicUploader
Versuchen Sie '@ character.profilepicture.save!' Nach '@ character.build_profilepicture' zu entfernen. – Pavan
Ich fürchte, ich bekomme immer noch den gleichen Fehler. – Bazley