My Rails Project

So, I first of all want to apologize for not writing sooner. I'm currently working 2 part time jobs and taking care of my kids will going through the stuff on Learn. This whole adventure has been a learning experience for sure and it's not over yet. I still have more to learn and thankfully, I feel like I have come a long way. When I was learning C#, I feel like some processes were easier to learn than rails or sinatra for that matter, but you had to all of your own SQL queries by yourself. I wasn't able to use ActiveRecord! It really makes using queries a lot easier!

Lets get to the real reason I'm writing this post. I'm finished with my Rails project!!!!!!! Woohoo! I'm so excited. I will warn you though. I focused mostly on functionality and just did very basic design.

The idea behind this project came from a non-profit group that I'm in. They used to use Yahoo Groups for their communication needs, however people's email accounts were constantly getting hacked so we had to come up with something else. We ended up using Facebook. Sounds like a good choice in theory, however, not all of our members use Facebook much and some don't even have an account! This means that we have to make a post on Facebook as well as send an email and hope that between the two people see them. It's not a horrible setup, but it can be made better. Everyone in the group really liked the way that Yahoo groups sent emails and you could respond to the email and it would post to the website and send out an email showing the response. While I don't have that functionality setup in this project, I wanted to get the basics setup and then I can work on extras like sending email. I already started looking for a ruby gem that would do that and think that will be relatively simple to setup.

I started working on controllers models and views, doing all of the basic things to get functionality working. You know, a Users controller, session controller, posts controller and a comments controller.
Controllers determine what gets showed where. They pass information from the model to the view. A controller is where you put information about what should be displayed in a view as in if you want to get a list of all of the users on the message board, where do they go. Well, after you have setup your users controller and User model, you create your views. A list of all the users would go under the users#index page.

Then I worked on all of the models, getting the associations correct so that I could reference them in my views and controllers. I also had to setup the database tables for each of my sections, ie a user table, posts table, comments table etc. Once I got the basics done, meaning that a user could login and create posts and comments, I worked on making sure that they were authorized and that an admin had access to additional links that a user did not. Next I focused on getting all of the requirements for the project completed. Some of those requirements were easy and some were quite difficult. I got stuck on the nested resource requirement, not because I couldn't do it but because I couldn't think of what to add at first. I had already used partials to display comments under each post and have the new comment form visible from the post view. I decided on adding a user's address, partially because this would align with my original plan for this project (see above) and because I couldn't think of anything else that would fall within the realm of information needed for a message board.

My last step was to add a little bit of decoration. When I first started on the project, I setup basic colors just so I would be able to see where everything went. Once I finished the requirements of the project, I went ahead and made it look a little better by adding coordinating colors.

I learned a lot on this project. Separating out different aspects of a project makes a lot more sense to me. You don't have to worry about using the same names of variables and getting a value back that you weren't expecting because the variable keeps getting changed by different methods. MVC Also allowed me to organize my thoughts as well as my code so that if I ran into a problem, debugging was a lot easier. Another thing that I learned was the benefit of the phrase "vote early, vote often"... WAIT... That's not right. It's commit early, commit often. I realized the huge benefit of version control when I made a change to my code that broke it and then I was able to fix it by looking at my unchanged code on github. Such a life saver. Overall, this project was a lot of fun.

You can check out a video of the project here

Comments

Popular Posts