I've been learning Rails with great success these past two weeks. I've learned so many things during this period, much more than I've learned in a similar time frame for other languages / technologies. While there is still much, much more to learn (and memorize), I'm very happy in the time I'm investing in Rails, and don't mind spending most of my free time reading and coding.
However, something that has happened to me a couple of times is that I get confused with certain things. For example, last week, I was really confused when reading about how forms work in Rails, and how to save and edit records in a database. Basically, it all came down to its simplicity confusing the hell out of me. For example, to save a new user, the only line of code needed in the controller was User.new(params[:user])
. After watching this work nicely, I was amazed, but at the same time confused. How did Rails know what to save and in which fields? Where's the SQL code? After reading a bit more about the form_for
and form element helpers, as well as reading the logs, I found out how Rails does this automatically. Really great stuff.
However, some further confusion happened while reading about the form helpers. There were similar tags for the same thing. For example, there's a form_for
helper, as well as a form_tag
helper, which create the form in the web page. Same with the elements. The text_field
and text_field_tag
apparently did the same thing, albeit each had different parameters. So that caused a bit of confusion early on.
So, maybe my mind was just fatigued because of the week I had at work, or I didn't read my book well, but this caused me to look around to better understand these tags and what each one did, and why two (or more) similar helpers did different things. Thankfully, I'm the type of person who needs to know how things work. I'm never satisfied if I use something and if it works, I never question it. It may be the inner hacker in me.