From e3a2f07bc34952070b43d9a0982c6579bf8477e0 Mon Sep 17 00:00:00 2001 From: Paul Blaze Date: Wed, 22 Jul 2015 00:54:13 +0300 Subject: [PATCH] enhancements for epub generation pandoc README.md -f markdown_github -t epub3 --indented-code-classes=Ruby --tab-stop=2 -o RailsStyleGuide.epub --- README.md | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index c4bbe5d2..4d05162f 100644 --- a/README.md +++ b/README.md @@ -446,7 +446,6 @@ programming resources. complicated, it is preferable to make a class method instead which serves the same purpose of the named scope and returns an `ActiveRecord::Relation` object. Arguably you can define even simpler scopes like this. - ```Ruby @@ -500,13 +499,13 @@ programming resources. the `id` of the record as a String. It could be overridden to include another human-readable attribute. - ```Ruby - class Person - def to_param - "#{id} #{name}".parameterize - end + ```Ruby + class Person + def to_param + "#{id} #{name}".parameterize end - ``` + end + ``` In order to convert this to a URL-friendly value, `parameterize` should be called on the string. The `id` of the object needs to be at the beginning so @@ -515,12 +514,12 @@ programming resources. * Use the `friendly_id` gem. It allows creation of human-readable URLs by using some descriptive attribute of the model instead of its `id`. - ```Ruby - class Person - extend FriendlyId - friendly_id :name, use: :slugged - end - ``` + ```Ruby + class Person + extend FriendlyId + friendly_id :name, use: :slugged + end + ``` Check the [gem documentation](https://github.com/norman/friendly_id) for more information about its usage. @@ -816,10 +815,10 @@ when you need to retrieve a single record by some attributes. these directories must be described in the `application.rb` file in order to be loaded. - ```Ruby - # config/application.rb - config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')] - ``` + ```Ruby + # config/application.rb + config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')] + ``` * Place the shared localization options, such as date or currency formats, in