Ruby on Rails Monday, December 21, 2015

Ok, here are the local logs and the production logs. While the local logs don't have any errors the production logs are complaining about the line
 
      @character.profilepicture.save!

in the controller.

local logs:
Started POST "/update_profile_picture?authenticity_token=q7pjfNN0v6matLmOvEY6O78cZ20aZNf9bVnOerV38we0dU317%2BRUeeA0OOOdinBkhCFy9XkzWnPlf%2BRvX6Sj6w%3D%3D&callsign=bazley&picid=2" for ::1 at 2015-12-21 20:10:10 +0000 

Processing by PicturethingsController#update_profile as JS 

  
Parameters: {"authenticity_token"=>"q7pjfNN0v6matLmOvEY6O78cZ20aZNf9bVnOerV38we0dU317+RUeeA0OOOdinBkhCFy9XkzWnPlf+RvX6Sj6w==", "callsign"=>"bazley", "picid"=>"2"} 

  
Character Load (0.3ms)  SELECT  "characters".* FROM "characters" WHERE "characters"."callsign" = $1 LIMIT 1 [["callsign", "bazley"]] 

  
Picturething Load (0.4ms)  SELECT  "picturethings".* FROM "picturethings" WHERE "picturethings"."id" = $1 LIMIT 1 [["id", 2]] 

  
Picturething Load (0.8ms)  SELECT  "picturethings".* FROM "picturethings" WHERE "picturethings"."character_profile_id" =$1 LIMIT 1  [["character_profile_id", 1]] 

   
(1.6ms)  BEGIN 

  SQL 
(4.6ms)  DELETE FROM "picturethings" WHERE "picturethings"."id" = $1  [["id", 18]] 

   
(3.8ms)  COMMIT 

   
(0.2ms)  BEGIN 

  SQL 
(5.3ms)  INSERT INTO "picturethings" ("character_profile_id", "picture", "created_at", "updated_at") VALUES ($1, $2,$3, $4) RETURNING "id"  [["character_profile_id", 1], ["picture", "profile_GOT1.jpeg"], ["created_at", "2015-12-21 20:10:11.624407"], ["updated_at", "2015-12-21 20:10:11.624407"]] 

   
(0.4ms)  COMMIT 

  
Rendered picturethings/update_profile.js.erb (0.6ms) 

Completed 200 OK in 786ms (Views: 4.4ms | ActiveRecord: 17.5ms)

Production logs:

2015-12-21T20:07:48.576449+00:00 app[web.1]: Started POST "/update_profile_picture?authenticity_token=Ubzl991xI%2FZwp8ZVxBRRxJZ060yLqQwgd4Oyz0m3r4bAc5Ofoa0U3JzsmVdKyocZXiLxLAVgvTexZymqOTZVHA%3D%3D&callsign=bazley&picid=1" for217.38.149.159 at 2015-12-21 20:07:48 +0000

2015-12-21T20:07:48.579647+00:00 app[web.1]: Processing by PicturethingsController#update_profile as JS

2015-12-21T20:07:48.579670+00:00 app[web.1]:   Parameters: {"authenticity_token"=>"Ubzl991xI/Zwp8ZVxBRRxJZ060yLqQwgd4Oyz0m3r4bAc5Ofoa0U3JzsmVdKyocZXiLxLAVgvTexZymqOTZVHA==", "callsign"=>"bazley", "picid"=>"1"}

2015-12-21T20:07:49.565800+00:00 heroku[router]: at=info method=POST path="/update_profile_picture?authenticity_token=Ubzl991xI%2FZwp8ZVxBRRxJZ060yLqQwgd4Oyz0m3r4bAc5Ofoa0U3JzsmVdKyocZXiLxLAVgvTexZymqOTZVHA%3D%3D&callsign=bazley&picid=1" host=websmash.herokuapp.com request_id=bd512b7f-9475-474a-a27b-265a558b5653 fwd="217.38.149.159"dyno=web.1 connect=0ms service=975ms status=422 bytes=1607

2015-12-21T20:07:49.545882+00:00 app[web.1]: Completed 422 Unprocessable Entity in 966ms (ActiveRecord: 9.1ms)

2015-12-21T20:07:49.549053+00:00 app[web.1]: 

2015-12-21T20:07:49.549058+00:00 app[web.1]: ActiveRecord::RecordInvalid (Validation failed: Picture Failed to manipulatewith MiniMagick, maybe it is not an image? Original Error: Command ("identify -quiet -ping /tmp/mini_magick20151221-12-kc1te5.jpg") failed: {:status_code=>1, :output=>"identify.im6: Not a JPEG file: starts with 0x23 0x3c `/tmp/mini_magick20151221-12-kc1te5.jpg' @ error/jpeg.c/JPEGErrorHandler/316.\n"}):

2015-12-21T20:07:49.549060+00:00 app[web.1]:   app/controllers/picturethings_controller.rb:12:in `update_profile'
  
character.rb:
  has_many :standardpictures, class_name: "Picturething",
                              inverse_of
: :character,
                              foreign_key
: "character_standard_id",
                              dependent
: :destroy
  accepts_nested_attributes_for 
:standardpictures

  has_one  
:profilepicture,   class_name: "Picturething",
                              inverse_of
: :character,
                              foreign_key
: "character_profile_id",
                              dependent
: :destroy
  accepts_nested_attributes_for 
:profilepicture


picturething.rb
  belongs_to      :character, class_name: "Character",
                              inverse_of
: :standardpictures,
                              foreign_key
: :character_standard_id
  belongs_to      
:character, class_name: "Character",
                              inverse_of
: :profilepicture,
                              foreign_key
: :character_profile_id
  mount_uploader  
:picture, CharacterpicUploader


uploaders/characterpic_uploaders.rb
  include CarrierWave::MiniMagick
  process resize_to_limit
: [900, 900]
  version 
:profile do
    process resize_to_fill
: [230, 230]
  
end
  
# Choose what kind of storage to use for this uploader:
  
if Rails.env.production?
    storage 
:fog
  
else
    storage 
:file
  
end
  
# Override the directory where uploaded files will be stored.
  
# This is a sensible default for uploaders that are meant to be mounted:
  
def store_dir
    
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  
end

At first glance it looks like MiniMagik doesn't think the file a a jpeg. I don't understand yet, I shall investigate further now, but that's the latest!

--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4116f778-e3af-4922-a736-77a69303b4a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment