The final section of week 3 of the course involved adding user votes to my application. This required some learning to understand what polymorphic association was. The best place to start is the Ruby on Rails Guide which states, “with polymorphic associations, a model can belong to more than one other model, on a single association”.
This is just a quick reminder on the make up of a URL and basic details of a HTTP request/response cycle.
Adding user authentication to my application is obviously very important if I want to restrict what actions people can take on my site if they aren't registered and to track the behaviour of users that are registered. There's quite a few steps to this so I thought I'd make a separate blog post to step through it.
This week involved more work on controllers and views with a focus on binding a form to an object by using form_for
. This is another really handy feature of rails that can save a lot of manual setup work.
This weeks post is going to be more of a reference guide for some of the important steps in creating a Rails application that I have come across in the first week of the Rails course. There's a heck of a lot to take in and this will be a handy point of reference for me.
Just a quick post about a book I got for Christmas called Practical Object-Orientated Design In Ruby. I've only just read the first chapter but already I'm seeing ways I could have improved the Blackjack game that I wrote in OO style.
Well, that's it I've finished week four and also the first Tealeaf Academy course. It has been a massive learning curve but I've got my first web application up and running called Blackjack World. Check it out and have a play!
I have been introduced to a code documentation specification called TomDoc that at it's most descriptive looks like this:
# Public: Duplicate some text an arbitrary number of times.
#
# text - The String to be duplicated.
# count - The Integer number of times to duplicate the text.
#
# Examples
#
# multiplex('Tom', 4)
# # => 'TomTomTomTom'
#
# Returns the duplicated String.
def multiplex(text, count)
text * count
end
I'm just coming to the end of week three of the Introduction To Ruby and Web Development course by Tealeaf Academy
It has been a pretty intense time so far and I've built tic tac toe, rock paper scissors and blackjack games in both procedural and object orientated code.
On top of learing Ruby (which is a fantastic language to write in!), I've been getting used to GitHub and now I'm a bit more comfortable at things like setting up new branches and merging them. I've also just setup this blog on GitHub pages using the Jekyll blogging platform. Hope you like it!