My journey to better programming and beautiful code

The Rails View book notes

Nov 13, 2014 | 3 minutes read

The Rails View book cover

Overall Review

I actually learned a few new tips and tricks from this book. It was nice to read a book that's mainly focused on the view end of Rails. And I was surprised by the amount of things I learned since I didn't really know there was that much to talk about for views. However, the book did go in a bit of a tangent regarding Sass (I am biased though since I already knew the syntax before reading this book). Overall I would definitely recommend this book! Go check out their website and the rules they have on Rails view layer.

Chapter 1

def currently_at(tab)
  render partial: 'layouts/main_nav', locals: {current_tab: tab}

Chapter 2

def creation_client_name(creation = @creation)
<%= render @creations %>
<%= controls_for_creation(creation) %>

Chapter 3

Chapter 4

Chapter 5

def field_item(attribute, text = nil, &block)
  @template.content_tag :li do
    @template.concat @template.label(attribute, text)

pass builder paramter to form_for

Chapter 6

@columns.each_with_object({}) do |(title, attribute), memo|

Chapter 7

Chapter 8

Chapter 9

comments powered by Disqus