Posted in Uncategorized

self.send

In Ruby the send method is a helper in passing a method and its arguments to the corresponding object. Its a way to DRY things up, but if you dont know what you are looking at, it can be really confusing.

class Report
  def basic
    “This is a basic report"
  end

  def complex
    “This is a complex report"
  end
end

@report = Report.new
@report.send(:basic)# same thing as @report.basic
>> “This is a basic report”

My initial confusion was in the context of a controller action ‘show’ —

  def show
    @sub_title = "Reports: " + @report.title
    self.send(@report.type)
    respond_to do |format|
      format.html
      format.xml
    end
  end

@report is instantiated in a before_filter based on what a user selected on the index page. In this particular case, self is the controller object, so you find the @report.type which is the report type attribute, is also a method within the controller.

Lets call type in the this case ‘basic’, so you would find in the controller(in my case) a method corresponding to it…although,I would likely move this to a controller helper to keep the controller skinny.

  def basic
    
  end

As you can imagine, this gives you alot of flexibity in building out templates and supplying the needed objects to each report.

Advertisements
Posted in Uncategorized

What the The Iron Yard did for me

It was February 2015 when I sat down and had coffee with John Saddington to talk about enrolling into a new coding bootcamp that was launching in Atlanta. I had heard about the IY being in North Carolina and wished that they would come to the Atlanta area. It was a wish I made buried under a workload of documents, procedures and regulations. I was in the medical device space and I was not fond of the work I was doing and hadnt been for about 6 years. I wanted a change and software seemed like something I could do. They were promising a ‘Zero to Hero’ sort of career launch into software development regardless of experience.

I met John about 5 years earlier for breakfest looking for advice on how to build an app. His advice? Build a blog within my expertise. He basically said I was too far into my career to transition into software development. John said I would likely find a developer to help me build the app I wanted if I would put my effort into building a presence. Intersting how viewpoints change over time. I suspect the advent of iOS and AWS changed that for alot of people.

I didn’t take Johns advice. I really wanted to build software. I don’t know where I would be if I had built that blog, but three kids later, I still wanted to get into software. However, family took all my time, and with what little energy I had left, online and unstructured courses didnt help me get there. From what I recall from my early years in college was that I learned better in groups.

The IY was a 12 week fulltime course and it was a big commitment, especially for a single income family like ours. The thought of even asking my wife, Tracey, about it was ludicrous, but as God would have it, I was unemployed in a lax hiring market within my field of expertise. The subject would eventually came up which lead to a series of steps, first one being to reach out to John. That meeting led us to take the biggest hail mary leap of our life.

This would likely not have happened under any other circumstances because major changes like this in the midst of a young family of 5 can be considered foolish if not crazy.

In hindsight, the decision wasn’t crazy, but the journey was. Hours were long, stress was high, concepts were missed and would need to be grasped on top of newer material getting crammed down my throat. It was a firehose bolted to my mouth.

After 3 months of training, and another month to recover and make my portfolio pretty, my job hunt was at full capacity. By August I was employed with a small start-up. It was a huge relief and the culmination of a dream. Life was good, until some family medical issues came to light.

Now I will say, that my best effort was not put forward, but we were under allot of stress. Two months went by and I was fired. I was an experiment that did not work out. I was devastated and so was my wife. We did not need this, but life has a way of working itself out if you dont give up.

At this point, I was open to going back into my old field. I was not crazy about it, but I was open to it. I had only two months of salary in the previous 10 months, and it was hurting. Needless to say, I needed income.

I did take on a contract gig that ended in failure and I’ll probably post about that another day, but my perseverence paid off and I landed a software engineering position in a most unlikely industry for a ROR position. Insurance.

To say that I love my work is an understatement. I cant believe I get paid to do this kind of work. I’m going into June 2016 at my current role and its like an extended version of the IY, except I’m getting paid!