bloc referral

If you are interested in learning to code with a mentor, try bloc and get $100 off.

Friday, February 6, 2015

Faker error

It's been a while since I used the Faker gem for anything and had an error I spent a bit of time on. I kept getting the error "TypeError: can't cast Array to string", but had no idea where that was coming from. I checked my image string and it was fine; I also tried adding in the an Active Model Serializer for my api (but that had nothing to do with it).













I discovered via this blog post, and found out my `Faker::Lorem` call was spitting out an array and I assumed it was a string. I switched it up to `Faker::Lorem.words(2).join(" ")` and all is well.

Simple solution I know, but I spent long enough on this to make sure it was in a blog post to prevent future mistakes.

No comments:

Post a Comment