Articles Tags Authors Most Popular

Day 2 - Tagging, Adding Images

Tags: ruby rails programming day2 images tags

Today I begin I3, which consists of building a Tagging feature into the blog. This went pretty well aside from a point where I got completely lost and my code was not working even though I was following the steps in the tutorial. But, I learned that you should read the Terminal whenever possible to see what kind of actions were taking place on the rails server. Then I found out that you can use rails console to check on the individual articles to see what attributes and values they have in your database! These are very convenient checks to know why something is not showing up or working the way you intended it to! Later on I attempted to add images to the blog posts. I ran into an issue with the brew install of imagemagick. I was getting an error that there was an undefined method and I just could not get the damn thing to install! Well, the Slack channel helped me out. I just needed to run brew doctor, which told me that I should run a sudo command with some things in it, which I then did. And that led me to another warning that told me I should update my homebrew. That is simple done by typing brew update and then voila I was ready. And then the brew install imagemagick worked seamlessly. Then I was trying to add images to the blog. Everything was humming along, the forms were built, I was able to "attach" but then none of my images were showing up in the articles. I also went into the rails console and I noticed that I was getting nil for all of the image values. I thought that was strange so I decided to watch what the terminal spit out as I attached images and hit "Submit". Well, I found that the image file name was showing up in the Terminal which was good, and then I saw a little hint which read, unpermitted parameter! Boom! That meant I did not specify the permit of :image somewhere. So I did put it into my articles_helper.rb but I did not update the articles_controller.rb. But, I thought that was a little strange, why would I need to update in two places? And also, why is this file called articles_helper.rb? Shouldn't it be actually helping in some way? Well, I deleted the article params code in the controller and then the photos showed up! I had a redundancy and I got rid of it in the controller as the helper had my back! Well that’s it for today!

Comments (1)

Comment by Lark

Posted 9 months later

Thank you so much for this! I have not been this moved by a blog post for a long period of time! You have got it, whatever that means in blogging. Well, Yo;28#&17ure definitely somebody that has something to say that people should hear. Keep up the wonderful job. Keep on inspiring the people!

Post a comment

<< Back to Articles List