I have a user model that has an avatar as an attachment. Like this:
#user.rb
attachment :avatar, type: :image
Im updating this image on my view, and calling a method on my controller. I put a logger debug to check the parameters that are going into my controller.
def update_profile
logger.debug("******** Im updating update_profile with #{:params}")
And so, on my output I got:
Processing by ProfilesController#update_profile as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"RPTztPwpRRFCmyaKytJuo2USQHFWxFUpr/9KKvM80CamgfJOs9tIVGl7LFVMcAxc+R8FnxdWqgAI4gP5wBV41Q==",
"user"=>{"avatar"=>"{\"id\":\"35c47de458393c007951857e5fe1296c444b40c6ee1144e39342136b84e9\",\"filename\":\"Captura de Tela 2018-11-30 às 14.52.11.png\",\"content_type\":\"image/png\",\"size\":508316}"}}
I have a business rule that only Landscapes pictures should be on avatar. So, how can I check the height and weight of this picture on my controller?