KatPadi's Point

My First Lines of Rails

Parents usually take a picture of their baby’s first haircut.

Me? I am not a parent so I don’t. Instead, I blog about the first lines of codes that I write when I’m learning a new language. So I was asked to help for a particular Rails project! Yay. The issues for me were just simple because, as we all know, I am still a noob.

**variable/function names were changed because I don’t want to get sued by my company** 😛


module ContactsHelper

  def i_label_content(i)
    if i.settled?
      'Something Here'
    else
      capture_haml do 
        haml_tag :input, type: 'checkbox', name: 'promised_i[]', value: i.id, class: 'settle-box', 'data-inv-amt' => i.amount_due
      end
    end
  end

end

 

This was the simple task assigned to me. It’s haml + rails which are 2 new things for me. It’s basically a helper for a label change. Haha!

Somehow, I have to start somewhere so there it is.

Leave a Reply

Your email address will not be published. Required fields are marked *