Author Archives: Adam

I’ve moved…

ajonas.heroku.com Advertisements

Octopress

Follow directions here…   Setting Up Octopress http://octopress.org/docs/setup/ Had one hiccup in my system didn’t have Ruby 1.9.2 which .rvmrc file requires (https://rvm.io//workflow/rvmrc/). I had to go ahead and install it.   Deploying on Heroku: http://octopress.org/docs/deploying/heroku/   That all went fairly well… though I didn’t understand all the intermediate steps. I’ll have to take closer […]

Procs and lambdas

You know how everything in Ruby is an object, well, as it turns out that’s not quite true. Ruby blocks are not objects! So, blocks are not objects, but you can turn them into objects without too much trouble. We do this by wrapping our block in an instance of the Proc class… PROCS: Very standard to pass along a code block […]

=== case equality operator

In a case statement… case number when 5 #some code when 3 #more code else #something else end Behind the scenes 5 is being compared to number with the === operator, so 5 === number, 3 === number, etc   several = Proc.new { |number| number > 3 && number < 8 } none = […]

Rails 1st Lecture

Rails Lecture I – July 2 How the web works: -the requests we send to other servers have headers with info about the request -you get the response with a header and the body -the body is just text and data with HTML -the communication happens over TCP/IP, namely HTTP – the browser renders the […]

The tap method

I haven’t found great explanations for this yet but there is a video below… The tap method is available to all Ruby objects and serves as a way to have a block “act on” the method’s caller and return the object called. Per the Ruby docs, “the primary purpose of this method is to ‘tap […]

Stack Level Too Deep Error

This error generally happens when you accidentally recursively changing an attribute. If you have a username attribute in User model, and a virtual attribute named username, that is directly changing the username, you end up calling the virtual, the virtual calls the virtual again and so on.. Therefore, take a look on whether something like […]