why array turning string?
i declared array , tried push on it:
url = params[:img_url] job = job.find(params[:job_id]) puts "addphoto==============================================b4" puts "job.photos:#{job.photos}-#{job.photos.instance_of? array}" puts "=====================================================" job.photos = array.new if (!job.photos) puts "addphoto==============================================aft" puts "job.photos:#{job.photos}-#{job.photos.instance_of? array}" puts "=====================================================" job.photos.push(url)
minus puts
i'm doing creating new empty array if there isn't one, push.
my logs say:
2017-04-05t17:51:41.034394+00:00 app[web.1]: addphoto==============================================b4 2017-04-05t17:51:41.034467+00:00 app[web.1]: job.photos:-false 2017-04-05t17:51:41.034490+00:00 app[web.1]: ===================================================== 2017-04-05t17:51:41.034687+00:00 app[web.1]: addphoto==============================================aft 2017-04-05t17:51:41.034713+00:00 app[web.1]: job.photos:[]-false 2017-04-05t17:51:41.034715+00:00 app[web.1]: ===================================================== 2017-04-05t17:51:41.035141+00:00 app[web.1]: completed 500 internal server error in 15ms (activerecord: 6.7ms) 2017-04-05t17:51:41.036043+00:00 app[web.1]: 10 tid-ox2i47d2w fatal: 2017-04-05t17:51:41.036045+00:00 app[web.1]: nomethoderror (undefined method `push' "[]":string): 2017-04-05t17:51:41.036046+00:00 app[web.1]: app/controllers/mobilevv/job_controller.rb:266:in `add_photo'
why newly created array not array? can't debug because happens in deployed server.
the exact same code throws in local server:
addphoto==============================================b4 job.photos:-false ===================================================== addphoto==============================================aft job.photos:[]-true =====================================================
what happening?
Comments
Post a Comment