It was not really my new year’s resolution but the way it went so far I have decided to give it a shot. I am sure there are so many people out there who help/support developers on a daily basis and I really want to thank them for doing it. I would like to share a story which led me to take this resolution even more seriously.
This question on StackOverflow: “’3' is not an ActiveModel-compatible object. It must implement :to_partial_path.” and it only happens when I add validations” got my attention this morning and honestly speaking I had no clue what so ever about the error but at the same time I really wanted to know the reason behind this issue. Hence, I kept my eye on this question and on the responses. Unfortunately for almost 55mins no one has answered or even commented here which is kind of frustrating and I can understand why not a lot of people have shown interest, as few of the portions were badly explained like: “ I noticed that if I add a subject the number in the paranthesis ‘3’ moves up. I wonder if it has something to do with the select form. Here’s the form:” So, I decided to jump in and figure out the issue. As someone can notice I have asked very silly questions like “where is the count method defined(count is in-built method from ActiveRecord)” “ you might want to check the syntax for select helper” “can you please add the console log” But didn’t gave up on him as I badly wanted to help this guy. Its also the time when I have to resume my work but I was pretty much convinced to ignore my work for next few hours. finally after a long comments and replies I noticed a small error on his code related to partials. There was a syntax error in the else part of create action(render (new)) which turned out to be the culprit.
Its should look something like this:
I am glad that I was able to help him and by reading his comments afterwards anyone can understand how happy he is. This incident made me realize that nothing will change around you on there own but if you spend sometime to help others surely something will change. You never know, this guy might be building something really awesome but because of some obstacles he may loose the speed, he might drop the idea of building this application. Hence, I have decided to help at least one person on StackOverflow or anywhere every day. hope I don’t break my resolution this time :). Happy Coding!!