Black History Social and the Journey to Omni Authentication
The past and the future work together to form the time that we call now, where all actions take place. I wanted to make a website for project that would honor Black History month but not be about Black History month. I wanted to it be place for sharing and learning different aspects of African and African American History, then and now, that would benefit the future. I was initially having difficulty with meeting the requirements for my project while also meeting the ideas for what I wanted my project to be. While I thought I was forcing relationships with has_many, belongs_to, and many_to_many with my models, it actually worked out really well as I began to implement the relationships. Not all of them stay the same as I move through the website, but they has to be modify to make them make sense to me. For example, I had a Questions model and it had many comments but I also wanted it to have answers. The user knows if they are trying to answer the question or just make a comment, so I kept the comments as they were but gave them an answers attribute of true and false that can be selected by the user. That way when the user that posted the question checks out the question, they can see who was trying to answer the question or just make a comment. Similarly, users might want to know what questions have been adequately answered, so I also gave questioned an answered attributed that signified a question as being answered.
Black History Social isn’t the usual social media type of website, where you can add friends — a feature that will be added in the future. However, the social aspect of the app is in the sharing of knowledge and working together to answer questions related to African and African-American History. Users can “Drop Some Knowledge” related to a person, place, event in related history, or users can post a question to other users to learn about something they are curious about. A social encyclopedia built for users with user generated content.
After my experience with building a Sinatra website/app, Ruby on Rails wasn’t that difficulty and I was able to get the basic functionality of my website going pretty quickly. However, since I had more time, I also had more time to play around with the CSS and HTML. I wanted to add a cool nav bar so I looked for some free nav bars to add to my app. If you ever looking for some, you can check these out: . Even though, I could see the nav bar it was behavior as expected. I later learn that I needed another gem to make it behave as expected: gem ‘bootstrap-sass’. Now, that I was essentially done with my app all I needed to do was add omni auth compatibly…
I followed the guidelines to setting up devise, so that’s what I was using initially for my users. I just couldn’t get it to work not matter what I tried, like it would go to the third party website. Once there, I would log in and my terminal would bug out and close the server, so it never returned to my website. I just did away with devise because while everything else was working, all the options that I tried to fix it kept getting progressively more complicated. I started from scratch with my own user model and the same thing was happening, which lead me to learning that it was something that I was doing causing the confusion between my site and the third party site. I successfully implemented it a lab before, so I went to check the difference between my project and the lab. It turned out to be a single line of code: skip_before_action :verify_authenticity_token, only: :provider. For security purposes rails doesn’t just allow users to cross domains like that, so I had to give it permission with this method. Everything was solid now!
In the future, I would like to add the ability for users to upvote/like answers, posts, questions, and comments, so they rise to the top and become more visible to visiting users on the site. As mentioned earlier I would also like to add the ability to make friends to truly make it a social experience.
We persevere through hard times while acknowledging the past to working to learn lessons from before to get to the future we want!