On 14 July 2015 at 20:29, Bazley <[email protected]> wrote:
> I have this error: `Errno::ENOENT in
> PicturethingsController#update_profile`.

Is that all it says?  Look in the log file to see if there is more.
It should tell you which line it failed on and I would have expected
some indication of the file it was looking for.

If not then simplify the method till you work out exactly which
statement is causing the problem.

As a thought, does the picture have an attached file or something like
that?  Is the dup trying to do something with the file?

Colin

>
> I'm trying to duplicate the standardpicture record and save that to
> @character.profilepicture. I also can't get @character.profilepicture to
> save to the database (I know from checking after entering the rails
> console).
>
> Here is the offending method:
>
> 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
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/ab3a7aeb-4fb6-467c-805e-1efc7bceffad%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvRwGuRGL%3DX%3DeMtxZaBVx15-3W1ruhW6UkWBR-yEU6uuw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to