exposition 0.0.5.pre.alpha → 0.0.5.1.pre.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/exposition/_layout.scss +19 -0
  3. data/app/assets/stylesheets/exposition/_posts.scss +1 -1
  4. data/app/views/exposition/posts/_post.html.haml +1 -1
  5. data/app/views/exposition/posts/show.html.haml +1 -1
  6. data/lib/exposition/version.rb +1 -1
  7. data/spec/dummy/Gemfile.lock +5 -5
  8. data/spec/dummy/log/development.log +555 -0
  9. data/spec/dummy/log/test.log +3186 -0
  10. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/--Du_sFjE8Ho1MLfRsWyVO7F76wxeRZ_SrUiXxz7l-E.cache +1 -0
  11. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-YS4-9IO0NKvI2O-26Uw5EXrp9yOaDxiv6YRScTBVoY.cache +0 -0
  12. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/28sOO6TXucM4XRJMbOmfyF6yW58w-2uR8-ZMm3IaRfk.cache +0 -0
  13. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2drWYv-yvCbySoggAnBpNW5GLRQlqp624s42-dC3qHs.cache +1 -0
  14. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2l3KRqwS5Cd7eS6dsQL9ygZdP-xtB6eRkqKkQc8pXXI.cache +0 -0
  15. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2rXtdgCo0O9sTtzZHhBK3NOYfubB765SIVyI5MZXu3A.cache +1 -0
  16. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/3Re-SPdld5Ct8p1S5WSqDL633DFKXkij_crDULWJyXA.cache +0 -0
  17. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/428kcur6EGQhfagkDY5S4aoCv-FSx7LwBDnc8rjQahw.cache +1 -0
  18. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +0 -0
  19. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5y3lG2Pkiko5LWI7DBbRgdmGTyDIJoZVKkQXtCd0jkI.cache +0 -0
  20. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/6pWaOcBo60lnnY7h9YyAyYYjGxsnxEm5IEUoWxL6XZU.cache +0 -0
  21. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8mdW2WAvsfZD1L0ftPCDwDB7E8D9hom8lQug3RH0uhA.cache +0 -0
  22. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ABzlkUJrfE-cjFhyZ5PuWALKeOdy8CwjXNfRIzxl05s.cache +1 -0
  23. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/B-dMGrQb6Jq89Vd80ToLJ7_uxJ2zpW9AlAf39eK8zQk.cache +0 -0
  24. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/BY3RJ2sGGlGg3uFUoiLbi1-x_PhVBEk-em9YOR0-LY0.cache +1 -0
  25. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/CiNKpcW4-sLd7yY2sd_JdOGzlYzGSgPJkntXdVGSH5M.cache +0 -0
  26. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ED7-yyP91lwAxP2UpCvsjUe7rFtQANiii75AJTukMyM.cache +0 -0
  27. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Eg50lhvVkNw-0YACIFcQXHdUD2NUvdY8XKuMVznSI5I.cache +0 -0
  28. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Evzt45ntMHYTFBPc1eetVkbgxfmBTAWldNYHTRRMBAc.cache +0 -0
  29. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/FnLKPsbGwbXF196nsl9iaAvVdn8UXgftB_-FQ5LKjEA.cache +1 -0
  30. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/GIYXIJ68-SpHozS6vgb5xdIcanYeuwU6i4HB7QdOBbI.cache +0 -0
  31. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/H2UYHyke6_dKOonHjCietpqQHxT4EyZsGg4zWUtZFQ4.cache +1 -0
  32. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/HFkfF-ltRaDmCJDANB9WxBN98MibE7qVvxfvDKe9zIU.cache +0 -0
  33. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/HRqMU0VmCtD6x-lrVu06EIlA7RW4qWbjNHFPXD_PaUY.cache +1 -0
  34. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ILq0NO5I__EYtTW3VMpgaZ1YIbVnDFnDnA4Eadaa7z4.cache +0 -0
  35. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ig9YTxhOjKAk-kSWNm12z-KZheLiEGxn-5lq7PfvTXg.cache +1 -0
  36. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ih8SymALPqQoli-VYK8CNFWT98mIOFrISYKVJwvjFU8.cache +0 -0
  37. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/J3u3gvOMaK85ILdQNR7T52nbpZHt_OwZQWcPWJunGIM.cache +1 -0
  38. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/JYlKQEBl3cI6wNgB5Yh-KMK6aC8bpPY7N2Mj0RgTo4c.cache +0 -0
  39. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/LTc5eDOi0V7NZyvXtAooOB15qN5pg9tbEcIjRuxzP0s.cache +1 -0
  40. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/MHSHoJwDG-1oLgzJcxxqaHuSAlxbHwb4iNQOfV8uwrk.cache +1 -0
  41. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/NiutOW6EDZ_9dgZfFuyiCuP9gcREPuVUr4LThfpLnBE.cache +1 -0
  42. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/NmfsICHqIQ_Jx2iVKiK-MUpw4ESexhxwmGu3_qPZWfM.cache +0 -0
  43. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +0 -0
  44. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/OREOExxNQJ0dPQEx0-yIMP1xtNHz-1l-QqkLDnQbRjY.cache +0 -0
  45. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/PrVgD4T5sb73HoyVm2eroUCHd31NgRhrXsqxqGMHwTY.cache +0 -0
  46. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/QwqCkkW7Zdhw57GBOr1WFit_n4dFDrO0X8qW4lbzh1o.cache +0 -0
  47. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/QysDwXrlIzDGVVDfRAVGemv6A8tywOFo2tagv6KthP4.cache +0 -0
  48. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/SPXzJCbBIvcAh2TVGRL1v2iWJh6nB1oX8PYpIWSswJA.cache +0 -0
  49. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/T4RQWxfvN_NDt0mxTqKG19HlwyicaHvBFPp07eTegSA.cache +0 -0
  50. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/TP0QdV2TZWrHLMN64sxuDeRWDAzyCXXaJ3cpJ9Zvbjs.cache +0 -0
  51. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/UTkJzK9QQxFu8MfCD7XIln9_uoWTFVgOyQqMgwjiJrY.cache +0 -0
  52. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Uo-LTUZWd2c-FQCWv9bUHed302evPQKOIQGi7T9ADV8.cache +1 -0
  53. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/UoMBiruAPI3kX_YQuYTO_V0GzisrIvTP5usRDzH44FM.cache +0 -0
  54. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/V5gtuz5d3aYHbAH0H4Hv0hRpNkt3mvAWlQsvJy-EWYA.cache +1 -0
  55. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/W6LJ1_cM6qZ3Eb7v3BxCBxxRkwlzs8n8-aO4z5tCJjk.cache +0 -0
  56. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/WBOJONtmQL5IKagQr-b0pRkH0o2Wi_mga9ZKmXUYc68.cache +1 -0
  57. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Xj0Oh2s1wiaAj963VfGxNJRnloidzejXgA0MUMwacVA.cache +1 -0
  58. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/YKWgZ1mrXRtHc0UBxTai5ZObb2tkTM_pYJbrR5qmlu8.cache +2 -0
  59. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Z7ELnG_UbZ-JxwN04tcF2CnPXbcaZQtMxDrUnk9gkkE.cache +1 -0
  60. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ZTmhll_Cx4uNvZ8Kr72Y5OLGE5EenDsOmh_BLjqNbLo.cache +1 -0
  61. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ZVf20_M1KO4Szm-NFa3Jwpp5SWWm-0RX71PWp1n7rvU.cache +1 -0
  62. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/_Z1lMvN2IV2epHXA4jNX1okaRV7jNlhV9wPc7BJNPss.cache +1 -0
  63. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/_a0s57HBQ1VujBTLlUcKPVKU1rz124K2qdcbn-zFiLQ.cache +0 -0
  64. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/_i7pkUlI21d5AZ9Fmyy9UN7x1CzwNG-oBuASjcsQEMk.cache +0 -0
  65. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/_pm6SITudGGaOEsN9sqoVdMdDeYZS7zm2WAHD7D8S0Q.cache +0 -0
  66. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/anIAWgBRz-1CSZHw4mesiZGvRnFXUVRX2z-Pujj4Y1w.cache +0 -0
  67. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/azCORiL9XJza75T255rojDq07BCX8PbSqimsoouKmdw.cache +0 -0
  68. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/bLBvfdO5IXMlcLMfs3p_vEdP1d2_cek5PzBf-N58Oh8.cache +0 -0
  69. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/cre710RF-rhM_eC9A9jJ2w9BL4OBdyTnREZtIvjzEKs.cache +0 -0
  70. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/cvNbdfsyauAPlv2tsUIJUY2pFr5__dairgB2rv7-MVA.cache +0 -0
  71. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/dOcqXWvKIi0TDGZ4LfQnrjXYbCEQQKHjsfR5hJsR5gk.cache +0 -0
  72. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/d_J3ZHCXSxTwf7JUrbR1iMtpHflHDKtcQOviJuAnMhE.cache +0 -0
  73. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/d_pTmZY65eBgp_DJOZi66tniZa5MrPnetX4uWyV1EWY.cache +0 -0
  74. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/dn1Zma7UK3jxW0jql6Ob2cO-PTvRWrxFvDxrAVLvPk4.cache +0 -0
  75. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/e2rJ7t726O_fLFnYgrpNdRxvRyaL3rOPJPafCVTUunk.cache +0 -0
  76. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/eBtFSDq-8OX42UW9WuKKpbNxBi4ixcU2Av2VjG-Vwew.cache +0 -0
  77. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ek1jB1Uksl1lLOLXk1JsQ0uUn7OjfQ1urmNUdopDtFI.cache +0 -0
  78. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/fKb6x8kk0layrM7evJHZZtqQD6-4ApE5tX3ZMCz5Ghw.cache +1 -0
  79. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/fw67tEnleFMKpEdB9iHp4zbJurOrwBQmafEwGViqLbI.cache +0 -0
  80. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/gdZwGWLha-nS_Hb2O0SVAwkK0zaISBXJ7TKiyvl_Rm4.cache +0 -0
  81. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/iZXaPjMDiP_Hgv5-pokJ2QKLou7JX2A_mN2Qu3Q1jGM.cache +0 -0
  82. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/iuFs1W8GmwtJO7Xmd3t8xcGFgjfw-PmdgokjQKhUcZM.cache +1 -0
  83. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/iw6eZ5-pBGjzEOZMj_v7wcLU8F5TGpwfdhornybWW04.cache +0 -0
  84. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/izyW-SS64Gu67MOHFx3_0yXu6EFmf3t_A5SLl0Qqkj8.cache +1 -0
  85. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/jHPsArpcqTzjRtFUNut0eVNjcziPzwsqH94JJttQOuE.cache +2 -0
  86. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/joGgs078HEmR2bl89iq_U8ZWRfyvMGSn5iryff5JXyM.cache +0 -0
  87. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/kaJPvLNuGrv5T5psoxqCBKJRJF3BqNDqNRX87usLS2k.cache +1 -0
  88. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lPvegLr7skf9k6s3LBhNR3eYLjcnAf7iIFy35sZDvgc.cache +1 -0
  89. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lbalmkAOS9quQsR-jsTAtKiXPM6skIO_bna0193VceU.cache +0 -0
  90. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lySPLgGmA17TMfKut-a5j6Us9YSPHtMUDmDorAJ_DzQ.cache +1 -0
  91. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lzToZTE7rhnwayiBOm8bHXNqtD9W51R4jLE1PdecBtw.cache +0 -0
  92. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/m30Muth-BCj1dhCyuw-kfJ2UE7uLYnmvccNo1A1a770.cache +0 -0
  93. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/nF-rK2naW1UdN2iWD3zjyJa-uLi30VEhtyy-YcP-wkA.cache +0 -0
  94. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ng7NZLFGrO3Kq1NeIDmG2FFBzfpTeH-So5R0dNIK09A.cache +1 -0
  95. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/nodRlAXuzCbR0AFQrj1AF83tnoSa5D2oVfh8KpIFa5g.cache +0 -0
  96. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oMpYMFwOFuBvV_xGv3E64agkOg0LjrnasxF357vVBVw.cache +0 -0
  97. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oQ7iVNOHdNpsSL5H78GzDDaEVT1AVkoCcJm-mi-3Ku4.cache +0 -0
  98. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pSBWGq4Q6POM6pOIdyIGmR8BpwPYnXTHpqtyYSdwSeg.cache +0 -0
  99. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/qEr0uW1BLnOjzGvVoMimub_UrZmlY47Bn1A7XMogoRI.cache +1 -0
  100. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/qMOJQvGJ0TmyaONlvnyuIRcJqcxh_KHOoHNzK90VIsc.cache +1 -0
  101. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/qQQCI0byLqtyFrOfSUvBpZap4yH3SOpqKO0kW7b2nts.cache +2 -0
  102. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/rAbUo9KBul03Ejhm9T9ZeFras7GzHQp1UzzWHZ8jiAY.cache +1 -0
  103. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/rU7QCLhaJHwx4qIKfC-Rfrqt5jLphitDzbz6GnOfKzk.cache +1 -0
  104. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/rgi-QLGO8mi2yT50N86KcULMTn-OnknH6TPABB1kAYA.cache +3 -0
  105. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/rnCxycAgUpmyCtQ0fgdaF82c2Tb66o6LKoO7ggkiR90.cache +0 -0
  106. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/se8Tubxms4LxEiKaxgfYbgkM7vOVwOns6mECjkY7-kU.cache +1 -0
  107. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/stHXvDU48Gyj6HjtwrqPWAddVapHSqTEHJWKQjUEF50.cache +0 -0
  108. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/t8Ds_l-2-0XuxkXiMltkgEyOWTx1TBLxewCVOBK2_G4.cache +0 -0
  109. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/tIyNlaDEEc1ObBdEOWhYNmq3s1rlF9GpfXA4gNq3dTI.cache +0 -0
  110. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/tvK_4wrEo6dE0vxTEcNvsaGC81eySncQIQv7QyvuCMs.cache +1 -0
  111. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/uIkJ80CnR1B3PpLnneL-FuDNdMPOYzKadg8EOqIVYhI.cache +2 -0
  112. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vAeqIDxnHeY2R5SD8fCvCgxJx8G0dvgh3W_GpFYLE1g.cache +0 -0
  113. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vTO4aVoJpaqQa7bbdZ8g2R369k9afCRl8cLMLzZhBxY.cache +1 -0
  114. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vTS2ln5bzUKEPLUVX_1kgAGtw1O5Dcfgm9YjvfzeYSU.cache +1 -0
  115. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vUZgkwtZ2I0739IR0QTRoANBXuCDFCxBFOEnYkWmK5s.cache +1 -0
  116. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vav8Qf5s1ely2ZDWB_kDuKXj3w-NZo6f3fraczzC7Jk.cache +0 -0
  117. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/veY7buYNXWnnaicUjhSPiffyiLBwZyC-4c6j8OFcFvg.cache +1 -0
  118. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xf7PUSwzbjpwiijiyD3A38guqbsIbBOWTHbL7bBYGzg.cache +1 -0
  119. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xk5L9htRcNytmh4-KKRMFpSnC92e1GErUSZ_QoCbUFc.cache +0 -0
  120. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xmHwrpZzVAB1ZsIpDuEjMXjp2F_wC_0CEPPJrWiPUhU.cache +1 -0
  121. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xqMWHYSvNcDcRNzjl4LfSFIZl66XSPTfPTDEA0tYojM.cache +0 -0
  122. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/yNMim883Wrgpy2ZeavrNj2qz6IqxKeHryuu_-hWTim4.cache +0 -0
  123. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/yOz_U0MUyUqaIuWInEZdx_zNxrGU6Kf1SFj2jY5V-zc.cache +0 -0
  124. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zCr4yznavhZea-Gw3C7q39eu8yrwtStrakOcmfAXz_o.cache +0 -0
  125. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zetSFnGYu9mn9IZpr6959lk3Hkt1joCSW93jZFEIv4A.cache +0 -0
  126. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zg0fGPLksEmnK8jaohh-kQNMwJGOpCdrDqufj6VK2n4.cache +1 -0
  127. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zjWzzpvo_sk4xEGRbgrAzAqg-ti22kzVIpzIpd5RBhk.cache +0 -0
  128. data/spec/dummy/tmp/pids/server.pid +1 -0
  129. metadata +216 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7cf5d3f355b9788afc5fc0472072820ac61666c4
4
- data.tar.gz: 6eb53d83c734530376a229f4c0bf5864d8808f11
3
+ metadata.gz: 5374b43f381bd949c35f9d6aef10444f72662845
4
+ data.tar.gz: 9c9815fd0390e0d0a177486a1f6c0689afb2385d
5
5
  SHA512:
6
- metadata.gz: c2ab294e6c9af17848d876ac0408801776ab4c9827fbbc33ac5c3b4edb03099261e09e3f611079da7e8e1a1945a6068bf748a829cf744f5253274a24b1c72c5f
7
- data.tar.gz: bf7af2d89ab477a6b1410ec344db482855e76b8d93f39bd483328dd0c3c193d657792134f1b61a3ba640c8dbf334191eb493cfc3090f86ea74d589dd7c37f9ab
6
+ metadata.gz: a9af39e2ff98328bdc5a7fa522411a8a973006d4e93b3fbbc46f4674c34ee4e23483df8d8d976943f3d68ec30d4e001a19a184e681d122f1466c93c9189dcaa2
7
+ data.tar.gz: 47423dd02fe443408a44611c52982810d9a1905b3e8ecd3b3ef9955d78d895eb93a6d3d21f3810d93622f76a8e587a31847cdafe8d27768c408793171bd02599
@@ -14,6 +14,25 @@ h1, h2, h3, h4, h5, h6 {
14
14
  color: $text-bold-color;
15
15
  }
16
16
 
17
+ h2 {
18
+ font-size: modular-scale(2);
19
+ }
20
+
21
+ h3 {
22
+ font-size: modular-scale(1);
23
+ }
24
+
25
+ h4 {
26
+ font-size: modular-scale(0);
27
+ }
28
+
29
+ h5 {
30
+ font-size: modular-scale(-1);
31
+ }
32
+
33
+ h6 {
34
+ font-size: modular-scale(-2);
35
+ }
17
36
 
18
37
  a {
19
38
  text-decoration: none;
@@ -10,7 +10,7 @@ section.no-posts {
10
10
  article {
11
11
  @include outer-container;
12
12
  @include base-padding;
13
- h3 {
13
+ h2 {
14
14
  font-size: modular-scale(2);
15
15
  margin: modular-scale(-4) 0;
16
16
 
@@ -1,7 +1,7 @@
1
1
  %article
2
2
  %time= "Published #{l(post.published_at.to_date, format: :long)}"
3
3
  .content.summary
4
- %h3= link_to(post.title, post)
4
+ %h2= link_to(post.title, post)
5
5
  = preserve do
6
6
  = markdown_to_html(post.summary)
7
7
  %section.info
@@ -1,5 +1,5 @@
1
1
  %article.post
2
2
  %section.content
3
- %h3= @post.title
3
+ %h2= @post.title
4
4
  = preserve do
5
5
  = markdown_to_html(@post.body)
@@ -1,3 +1,3 @@
1
1
  module Exposition
2
- VERSION = "0.0.5-alpha"
2
+ VERSION = "0.0.5.1-alpha"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/jklina/Development/exposition
3
3
  specs:
4
- exposition (0.0.3.pre.alpha)
4
+ exposition (0.0.5.pre.alpha)
5
5
  bcrypt (~> 3.1)
6
6
  bitters
7
7
  bourbon (~> 4.2)
@@ -57,7 +57,7 @@ GEM
57
57
  thread_safe (~> 0.3, >= 0.3.4)
58
58
  tzinfo (~> 1.1)
59
59
  arel (6.0.3)
60
- bcrypt (3.1.10)
60
+ bcrypt (3.1.11)
61
61
  bitters (1.2.0)
62
62
  bourbon (>= 4.2)
63
63
  sass (>= 3.4)
@@ -105,7 +105,7 @@ GEM
105
105
  mime-types (2.99)
106
106
  mini_portile2 (2.0.0)
107
107
  minitest (5.8.4)
108
- neat (1.7.2)
108
+ neat (1.7.4)
109
109
  bourbon (>= 4.0)
110
110
  sass (>= 3.3)
111
111
  nokogiri (1.6.7.2)
@@ -141,10 +141,10 @@ GEM
141
141
  rake (10.5.0)
142
142
  redcarpet (3.3.4)
143
143
  rouge (1.8.0)
144
- ruby_parser (3.7.3)
144
+ ruby_parser (3.8.1)
145
145
  sexp_processor (~> 4.1)
146
146
  sass (3.4.21)
147
- sexp_processor (4.6.1)
147
+ sexp_processor (4.7.0)
148
148
  sprockets (3.5.2)
149
149
  concurrent-ruby (~> 1.0)
150
150
  rack (> 1, < 3)
@@ -0,0 +1,555 @@
1
+
2
+
3
+ Started GET "/" for ::1 at 2016-03-09 10:34:58 -0500
4
+ Processing by Exposition::PostsController#index as HTML
5
+  (4.1ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT 10 OFFSET 0) subquery_for_count [["published", "t"]]
6
+ Exposition::Post Load (3.9ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT 10 OFFSET 0 [["published", "t"]]
7
+ Categorical::Tag Exists (4.0ms) SELECT 1 AS one FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 LIMIT 1 [["taggable_id", 1], ["taggable_type", "Exposition::Post"]]
8
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (19.9ms)
9
+ Categorical::Tag Exists (0.7ms) SELECT 1 AS one FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 LIMIT 1 [["taggable_id", 2], ["taggable_type", "Exposition::Post"]]
10
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.5ms)
11
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml (75.2ms)
12
+  (0.3ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", "t"]]
13
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (140.8ms)
14
+ Completed 200 OK in 2053ms (Views: 1943.1ms | ActiveRecord: 50.1ms)
15
+
16
+
17
+ Started GET "/assets/exposition/application.self-0da07a5e42f9d943e9f5c2f290c5a50be8a71195748c98dcf85a2a64ec8854e3.css?body=1" for ::1 at 2016-03-09 10:35:00 -0500
18
+
19
+
20
+ Started GET "/" for ::1 at 2016-03-09 10:35:31 -0500
21
+ Processing by Exposition::PostsController#index as HTML
22
+  (0.9ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT 10 OFFSET 0) subquery_for_count [["published", "t"]]
23
+ Exposition::Post Load (1.0ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT 10 OFFSET 0 [["published", "t"]]
24
+ Categorical::Tag Exists (0.7ms) SELECT 1 AS one FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 LIMIT 1 [["taggable_id", 1], ["taggable_type", "Exposition::Post"]]
25
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.8ms)
26
+ Categorical::Tag Exists (0.8ms) SELECT 1 AS one FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 LIMIT 1 [["taggable_id", 2], ["taggable_type", "Exposition::Post"]]
27
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (2.2ms)
28
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml (13.1ms)
29
+  (0.4ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", "t"]]
30
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (24.8ms)
31
+ Completed 200 OK in 52ms (Views: 47.2ms | ActiveRecord: 3.9ms)
32
+
33
+
34
+ Started GET "/assets/exposition/application.self-0da07a5e42f9d943e9f5c2f290c5a50be8a71195748c98dcf85a2a64ec8854e3.css?body=1" for ::1 at 2016-03-09 10:35:31 -0500
35
+
36
+
37
+ Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-03-09 10:35:31 -0500
38
+
39
+
40
+ Started GET "/" for ::1 at 2016-03-09 10:35:40 -0500
41
+ Processing by Exposition::PostsController#index as HTML
42
+  (0.5ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT 10 OFFSET 0) subquery_for_count [["published", "t"]]
43
+ Exposition::Post Load (0.7ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT 10 OFFSET 0 [["published", "t"]]
44
+ Categorical::Tag Exists (0.6ms) SELECT 1 AS one FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 LIMIT 1 [["taggable_id", 1], ["taggable_type", "Exposition::Post"]]
45
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.4ms)
46
+ Categorical::Tag Exists (0.6ms) SELECT 1 AS one FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 LIMIT 1 [["taggable_id", 2], ["taggable_type", "Exposition::Post"]]
47
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.3ms)
48
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml (9.2ms)
49
+  (0.4ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", "t"]]
50
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (19.1ms)
51
+ Completed 200 OK in 658ms (Views: 654.4ms | ActiveRecord: 2.8ms)
52
+
53
+
54
+ Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-03-09 10:35:40 -0500
55
+
56
+
57
+ Started GET "/assets/exposition/application.self-8f19aaf36b36ca6b51a36609715d8d3eb66894ef841f3aaffd831fb6f86cbd59.css?body=1" for ::1 at 2016-03-09 10:35:40 -0500
58
+
59
+
60
+ Started GET "/" for ::1 at 2016-03-09 10:36:12 -0500
61
+ Processing by Exposition::PostsController#index as HTML
62
+  (1.6ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT 10 OFFSET 0) subquery_for_count [["published", "t"]]
63
+ Exposition::Post Load (1.5ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT 10 OFFSET 0 [["published", "t"]]
64
+ Categorical::Tag Exists (0.9ms) SELECT 1 AS one FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 LIMIT 1 [["taggable_id", 1], ["taggable_type", "Exposition::Post"]]
65
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (5.8ms)
66
+ Categorical::Tag Exists (0.5ms) SELECT 1 AS one FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 LIMIT 1 [["taggable_id", 2], ["taggable_type", "Exposition::Post"]]
67
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.8ms)
68
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml (33.6ms)
69
+  (0.6ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", "t"]]
70
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (83.1ms)
71
+ Completed 200 OK in 212ms (Views: 174.1ms | ActiveRecord: 5.0ms)
72
+
73
+
74
+ Started GET "/admin/login" for ::1 at 2016-03-09 10:36:13 -0500
75
+ Processing by Exposition::Admin::SessionsController#new as HTML
76
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/sessions/new.html.haml within layouts/exposition/admin (35.9ms)
77
+ Completed 200 OK in 230ms (Views: 229.3ms | ActiveRecord: 0.0ms)
78
+
79
+
80
+ Started POST "/admin/login" for ::1 at 2016-03-09 10:36:20 -0500
81
+ Processing by Exposition::Admin::SessionsController#create as HTML
82
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"HdPc7HphbJ1ElERBhZYVN5QmruQqafhdlbI7Rt4mQ00gJCLOiIoVzonvYJ+i37D4Ic0TPglSUZx2P2vIINFZHA==", "session"=>{"email"=>"admin@admin.admin", "password"=>"[FILTERED]"}, "commit"=>"Log in"}
83
+ Exposition::User Load (3.1ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."email" = $1 LIMIT 1 [["email", "admin@admin.admin"]]
84
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/sessions/new.html.haml within layouts/exposition/admin (1.3ms)
85
+ Completed 200 OK in 217ms (Views: 37.1ms | ActiveRecord: 6.4ms)
86
+
87
+
88
+ Started POST "/admin/login" for ::1 at 2016-03-09 10:36:27 -0500
89
+ Processing by Exposition::Admin::SessionsController#create as HTML
90
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"bC5xG33IHurkOflJQz7Mj5m0n3S1G7zlLAqeh5ZOKhZR2Y85jyNnuSlC3Zdkd2lALF8irpYgFSTPh84JaLkwRw==", "session"=>{"email"=>"admin@admin.admin", "password"=>"[FILTERED]"}, "commit"=>"Log in"}
91
+ Exposition::User Load (0.6ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."email" = $1 LIMIT 1 [["email", "admin@admin.admin"]]
92
+  (0.3ms) BEGIN
93
+ SQL (9.1ms) UPDATE "exposition_users" SET "remember_digest" = $1, "updated_at" = $2 WHERE "exposition_users"."id" = $3 [["remember_digest", "$2a$10$eC.gd.JrFwfyGq7LFBxULekxrERLWokhbvgvYdxJvIPMCIIfMchdm"], ["updated_at", "2016-03-09 15:36:28.093736"], ["id", 1]]
94
+  (1.6ms) COMMIT
95
+ Redirected to http://localhost:3000/admin/posts
96
+ Completed 302 Found in 218ms (ActiveRecord: 11.6ms)
97
+
98
+
99
+ Started GET "/admin/posts" for ::1 at 2016-03-09 10:36:28 -0500
100
+ Processing by Exposition::Admin::PostsController#index as HTML
101
+ Exposition::User Load (0.4ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]]
102
+ Exposition::Post Load (0.9ms) SELECT "exposition_posts".* FROM "exposition_posts" ORDER BY "exposition_posts"."published_at" DESC LIMIT 25 OFFSET 0
103
+ CACHE (0.0ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]]
104
+ Categorical::Tag Load (0.6ms) SELECT "categorical_tags".* FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 [["taggable_id", 1], ["taggable_type", "Exposition::Post"]]
105
+ CACHE (0.0ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]]
106
+ Categorical::Tag Load (0.8ms) SELECT "categorical_tags".* FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 [["taggable_id", 2], ["taggable_type", "Exposition::Post"]]
107
+  (0.5ms) SELECT COUNT(*) FROM "exposition_posts"
108
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/index.html.haml within layouts/exposition/admin (42.2ms)
109
+ Completed 200 OK in 109ms (Views: 102.8ms | ActiveRecord: 3.3ms)
110
+
111
+
112
+ Started GET "/admin/posts/test-title/edit" for ::1 at 2016-03-09 10:36:31 -0500
113
+ Processing by Exposition::Admin::PostsController#edit as HTML
114
+ Parameters: {"id"=>"test-title"}
115
+ Exposition::User Load (0.5ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]]
116
+ Exposition::Post Load (0.5ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."slug" = $1 LIMIT 1 [["slug", "test-title"]]
117
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/shared/_error_handler.html.haml (9.3ms)
118
+ Exposition::User Load (0.5ms) SELECT "exposition_users".* FROM "exposition_users"
119
+ Categorical::Tag Load (0.5ms) SELECT "categorical_tags".* FROM "categorical_tags"
120
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/_form_fields.html.haml (27.2ms)
121
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/edit.html.haml within layouts/exposition/admin (51.4ms)
122
+ Completed 200 OK in 108ms (Views: 102.9ms | ActiveRecord: 2.1ms)
123
+
124
+
125
+ Started PATCH "/admin/posts/test-title" for ::1 at 2016-03-09 10:37:06 -0500
126
+ Processing by Exposition::Admin::PostsController#update as HTML
127
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"FEQlNZv06UArFhydLCeKoPVTVHnuwI8K0B8NFNl+gk8ps9sXaR+QE+ZtOEMLbi9vQLjpo837Jsszkl2aJ4mYHg==", "post"=>{"title"=>"Test Title", "summary"=>"## H2\r\n###H3\r\n####H4\r\n#####H5\r\n######H6 \r\n\r\n* Blocks\r\n* Modules\r\n* Difference between including and extending Modules\r\n* Difference between instance and class methods\r\n\r\n## Demonstration\r\n\r\nOne of the most common problems that seem to naturally arise in code is handling objects that share a _role_. This tends to be an issue that is not immediately apparent, but as the application grows it begins to present itself. Let's illustrate this with a concrete example taken from the code used in this blog. A lot of this code will be ActiveRecord syntax, but the underlying concepts can be applied to plain old Ruby objects as well.", "body"=>"## Prerequisites \r\n\r\n* Blocks\r\n* Modules\r\n* Difference between including and extending Modules\r\n* Difference between instance and class methods\r\n\r\n## Demonstration\r\n\r\nOne of the most common problems that seem to naturally arise in code is handling objects that share a _role_. This tends to be an issue that is not immediately apparent, but as the application grows it begins to present itself. Let's illustrate this with a concrete example taken from the code used in this blog. A lot of this code will be ActiveRecord syntax, but the underlying concepts can be applied to plain old Ruby objects as well. When laying out out the code for the blog we have objects for `Posts` and `BookReviews` that look like the following:\r\n\r\n\r\n```ruby\r\nclass Post < ActiveRecord::Base\r\n belongs_to :author, class_name: 'User'\r\n\r\n validates_presence_of :title, :body, :author\r\n validates_length_of :title, maximum: 244\r\n validates_presence_of :author\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n before_save :set_published_at_date\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n def self.published\r\n where(published: true)\r\n end\r\n\r\n def self.sorted_by_published_date\r\n order(published_at: :desc)\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\n\r\n def set_published_at_date\r\n if published_changed?(from: false, to: true)\r\n self.published_at = Date.today\r\n end\r\n end\r\nend\r\n```\r\n\r\n```ruby\r\nclass BookReview < ActiveRecord::Base\r\n belongs_to :author, class_name: 'User'\r\n\r\n validates_presence_of :book_title, :body, :book_author\r\n validates_length_of :book_title, :book_author, maximum: 244\r\n validates_presence_of :author\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n before_save :set_published_at_date\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n def self.published\r\n where(published: true)\r\n end\r\n\r\n def self.sorted_by_published_date\r\n order(published_at: :desc)\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\n\r\n def set_published_at_date\r\n if published_changed?(from: false, to: true)\r\n self.published_at = Date.today\r\n end\r\n end\r\nend\r\n```\r\n\r\nLet's go through this code a bit. You'll notice that despite being two different objects, they have quite a bit of behavior in common. To start, they both belong to an Author and validate that an author is present. Additionally they both have slugs for friendly urls, a call to the method `#parameterize_slug` to ensure the slug is URL friendly, and some validations to ensure the URL is present, unique, and it fits in the DB. Finally both of these objects can be marked as published and have scopes for filtering based on whether they're published or not.\r\n\r\nLooking at this code we can see a lot of duplicate code. Both of these objects share similar roles and these roles have the same behavior. You could say they're both _sluggable_, _publishable_, and _authorable_. To refactor this duplicate code we should use Ruby's [module](http://ruby-doc.org/core-2.2.0/Module.html \"Ruby Module\"). Ruby's module will allow us to 'mixin' common code to objects that share roles. Let's start with the code that makes an object play the _authorable_ role. \r\n\r\n```ruby\r\nmodule Authorable\r\n def self.included(base)\r\n base.class_eval do\r\n belongs_to :author, class_name: 'User'\r\n validates_presence_of :author\r\n end\r\n end\r\nend\r\n```\r\n\r\nThis is some dense code if you've never seen this pattern before, so let's step through it. The method `.included` is a built in hook method that gets called when a Ruby module is included in a class. The `base` argument is simply the included class. So by including the `Authorable` module into the `Post` class, the `.included` method will be called with the `Post` class set to `base`. Since `base` is now equal to `Post` we can open up the `Post` class can evaluate code using Ruby's `class_eval` method. The code inside the block will be evaluated as if it were in the `Post` class.\r\n\r\n**Note:** This pattern is so common that the Rails framework actually provides a special module for this type of refactoring that's called a [Concern](http://api.rubyonrails.org/classes/ActiveSupport/Concern.html \"Rails Concern\"). Feel free to use this module if you like, however I'm using the traditional way so we can use it without ActiveSupport.\r\n\r\nNow that we lumped all the code related to making an object play the _authorable_ role into the `Authorable` module, let's rewrite our `Post` and `BookReview` classes to use our new module.\r\n\r\n```ruby\r\nclass Post < ActiveRecord::Base\r\n include Authorable\r\n\r\n validates_presence_of :title, :body, :author\r\n validates_length_of :title, maximum: 244\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n before_save :set_published_at_date\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n def self.published\r\n where(published: true)\r\n end\r\n\r\n def self.sorted_by_published_date\r\n order(published_at: :desc)\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\n\r\n def set_published_at_date\r\n if published_changed?(from: false, to: true)\r\n self.published_at = Date.today\r\n end\r\n end\r\nend\r\n```\r\n\r\n```ruby\r\nclass BookReview < ActiveRecord::Base\r\n include Authorable\r\n\r\n validates_presence_of :book_title, :body, :book_author\r\n validates_length_of :book_title, :book_author, maximum: 244\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n before_save :set_published_at_date\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n def self.published\r\n where(published: true)\r\n end\r\n\r\n def self.sorted_by_published_date\r\n order(published_at: :desc)\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\n\r\n def set_published_at_date\r\n if published_changed?(from: false, to: true)\r\n self.published_at = Date.today\r\n end\r\n end\r\nend\r\n```\r\nIn the end we removed the duplication, but more importantly we learned a pattern that we can apply to the other roles these two objects have in common. Let's next tackle the common code that makes these objects _publishable_. Again, we'll start by creating a new `Publishable` module to put code for our _publishable_ role. \r\n\r\n```ruby\r\nmodule Publishable\r\n module ClassMethods\r\n def published\r\n where(published: true)\r\n end\r\n\r\n def sorted_by_published_date\r\n order(published_at: :desc)\r\n end\r\n end\r\n\r\n def self.included(base)\r\n base.extend(ClassMethods)\r\n base.class_eval do\r\n before_save :set_published_at_date\r\n end\r\n end\r\n\r\n def css_classes\r\n if published?\r\n return \"published\"\r\n else\r\n return \"not-published\"\r\n end\r\n end\r\n\r\n private\r\n\r\n def set_published_at_date\r\n if published_changed?(from: false, to: true)\r\n self.published_at = Date.today\r\n end\r\n end\r\nend\r\n```\r\n\r\nYou'll notice this module has a bit more to it than the `Authorable` module. Let's walk through the new changes. Right away you see that we have a module within the `Publishable` module called `ClassMethods`. We're going to use the `ClassMethods` module as a container for defining methods that we want to add as class methods (as opposed to instance methods) to our _publishable_ objects. In our `.included` hook method that we used before, you'll notice that in addition to evaluating code we also `extend` our base class with the `ClassMethods` module. This adds (or mixes in) the methods in `ClassMethods` with the base or _publishable_ class, but since we're using `extend` they're added as class methods, not instance methods. Lastly, we have the `#css_classes` and `#set_published_at_date` methods. These are instance methods and will automatically be included as instance level methods when the module is included. Once again let's refactor our `Post` and `BookReview` classes.\r\n\r\n```ruby\r\nclass Post < ActiveRecord::Base\r\n include Authorable\r\n include Publishable\r\n\r\n validates_presence_of :title, :body, :author\r\n validates_length_of :title, maximum: 244\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\nend\r\n```\r\n\r\n```ruby\r\nclass BookReview < ActiveRecord::Base\r\n include Authorable\r\n include Publishable\r\n\r\n validates_presence_of :book_title, :body, :book_author\r\n validates_length_of :book_title, :book_author, maximum: 244\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\nend\r\n```\r\n\r\nThings are really starting to get cleaned up and duplicate lines of code are disappearing. Let's use the same pattern one last time for removing the duplication when it comes to the _sluggable_ role. Once again we'll create a `Sluggable` module to correspond to the _sluggable_ role and add the related code to the module. \r\n\r\n```ruby\r\nmodule Sluggable\r\n def self.included(base)\r\n base.class_eval do\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n end\r\n end\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\nend\r\n```\r\n\r\nBy now you are familiar with everything this module is doing. We are evaluating some code in the context of the included _sluggable_ class within `class_eval` block and moving the instance methods relevant to the _sluggable_ role into the module which will be added to the to the _sluggable_ objects that include this module. Let's look at the final version of our `Post` and `BookReview` classes.\r\n\r\n```ruby\r\nclass Post < ActiveRecord::Base\r\n include Authorable\r\n include Publishable\r\n include Sluggable\r\n\r\n validates_presence_of :title, :body, :author\r\n validates_length_of :title, maximum: 244\r\nend\r\n```\r\n\r\n```ruby\r\nclass BookReview < ActiveRecord::Base\r\n include Authorable\r\n include Publishable\r\n include Sluggable\r\n\r\n validates_presence_of :book_title, :body, :book_author\r\n validates_length_of :book_title, :book_author, maximum: 244\r\nend\r\n```\r\n\r\nThose classes are really compact now. We also now have the neat side effect that when we add other models to our blog, adding roles will be trivially easy. For example, if we decide we want to add a Tags model, all we have to do is include the functionality we want. Tags don't need to play the roles of _authorable_ or _publishable_, but perhaps we want each Tag to have its own URL. To do this we can simply include the `Sluggable` module and be done with it (since this is technically a DB backed application we'll need to adjust the DB accordingly as well).\r\n\r\n## Warnings\r\nWhile this pattern is powerful there are trade-offs we have to consider. When including modules, the functionality behind each role is now not as apparent. Someone who isn't familiar with your code might wonder where all the functionality is hidden. This also adds a bit of cognitive load for the programmer as they now have code for one object in 3 additional different places they must consider. When refactoring out into modules, or anytime when using inheritance, you'll want to make sure you're constantly asking yourself, _will other programmers be able to easily navigate the code and find what they need_. \r\n\r\nWe could, for example, create another module called `Broadcastable` that would look something like:\r\n\r\n```ruby\r\nmodule Broadcastable\r\n include Authorable\r\n include Publishable\r\n include Sluggable\r\nend\r\n```\r\n\r\nAnd then include this in our `Post` and `BookReview` classes. While this does DRY up the code a bit, I feel that it adds too much complexity and cognitive load. Its not quite as clear as to what `Broadcastable` does and adds another layer in the inheritance tree that programmers must process. \r\n\r\nAnother thing to be careful with is using this pattern simply to remove duplicate code. Its important to consider that the purpose of the duplicate code is the same as opposed to having duplicate code purely because of coincidence. If the purpose is aligned, then its much more likely the future changes will be compatible with all involved objects. If the duplicate code exists between objects coincidentally, then its much more likely that the duplicate code may diverge in the future. Sometimes you might even want to hold off refactoring until further down the line, when the true roles of objects become more clear. \r\n\r\nWith these warnings in mind, factoring out common code that objects share by virtue of having a role into a module is a great way to organize shared behavior. \r\n\r\n## See More:\r\nTo see how to test this pattern, you can view the source code for this blog. It makes use of rspec's Shared Examples. In minitest you would simply use modules!\r\n\r\n* [Source code for this blog](https://github.com/jklina/joshklina.com \"joshklina.com source code\")\r\n* [Eloquent Ruby by Russ Olsen](http://amzn.to/1R2mkFA \"Eloquent Ruby\")\r\n* [Practical Object-Oriented Design in Ruby: An Agile Primer by Sandi Metz](http://amzn.to/1R2muN9 \"Eloquent Ruby\")\r\n* [Rails Concerns](http://api.rubyonrails.org/classes/ActiveSupport/Concern.html \"Rails Concerns\")\r\n", "author_id"=>"1", "slug"=>"test-title", "tag_ids"=>[""], "published"=>"1"}, "commit"=>"Update Post", "id"=>"test-title"}
128
+ Exposition::User Load (0.5ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]]
129
+ Exposition::Post Load (0.6ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."slug" = $1 LIMIT 1 [["slug", "test-title"]]
130
+  (0.2ms) BEGIN
131
+ Categorical::Tag Load (0.6ms) SELECT "categorical_tags".* FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 [["taggable_id", 1], ["taggable_type", "Exposition::Post"]]
132
+ CACHE (0.0ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]]
133
+ Exposition::Post Exists (9.8ms) SELECT 1 AS one FROM "exposition_posts" WHERE (LOWER("exposition_posts"."slug") = LOWER('test-title') AND "exposition_posts"."id" != 1) LIMIT 1
134
+ SQL (3.8ms) UPDATE "exposition_posts" SET "summary" = $1, "updated_at" = $2 WHERE "exposition_posts"."id" = $3 [["summary", "## H2\r\n###H3\r\n####H4\r\n#####H5\r\n######H6 \r\n\r\n* Blocks\r\n* Modules\r\n* Difference between including and extending Modules\r\n* Difference between instance and class methods\r\n\r\n## Demonstration\r\n\r\nOne of the most common problems that seem to naturally arise in code is handling objects that share a _role_. This tends to be an issue that is not immediately apparent, but as the application grows it begins to present itself. Let's illustrate this with a concrete example taken from the code used in this blog. A lot of this code will be ActiveRecord syntax, but the underlying concepts can be applied to plain old Ruby objects as well."], ["updated_at", "2016-03-09 15:37:07.077832"], ["id", 1]]
135
+  (0.6ms) COMMIT
136
+ Redirected to http://localhost:3000/admin/posts
137
+ Completed 302 Found in 188ms (ActiveRecord: 16.2ms)
138
+
139
+
140
+ Started GET "/admin/posts" for ::1 at 2016-03-09 10:37:07 -0500
141
+ Processing by Exposition::Admin::PostsController#index as HTML
142
+ Exposition::User Load (0.6ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]]
143
+ Exposition::Post Load (0.9ms) SELECT "exposition_posts".* FROM "exposition_posts" ORDER BY "exposition_posts"."published_at" DESC LIMIT 25 OFFSET 0
144
+ CACHE (0.0ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]]
145
+ Categorical::Tag Load (0.7ms) SELECT "categorical_tags".* FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 [["taggable_id", 2], ["taggable_type", "Exposition::Post"]]
146
+ CACHE (0.0ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]]
147
+ Categorical::Tag Load (0.6ms) SELECT "categorical_tags".* FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 [["taggable_id", 1], ["taggable_type", "Exposition::Post"]]
148
+  (0.6ms) SELECT COUNT(*) FROM "exposition_posts"
149
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/index.html.haml within layouts/exposition/admin (27.4ms)
150
+ Completed 200 OK in 81ms (Views: 75.6ms | ActiveRecord: 3.4ms)
151
+
152
+
153
+ Started GET "/" for ::1 at 2016-03-09 10:37:12 -0500
154
+ Processing by Exposition::PostsController#index as HTML
155
+  (0.6ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT 10 OFFSET 0) subquery_for_count [["published", "t"]]
156
+ Exposition::Post Load (1.1ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT 10 OFFSET 0 [["published", "t"]]
157
+ Categorical::Tag Exists (0.4ms) SELECT 1 AS one FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 LIMIT 1 [["taggable_id", 2], ["taggable_type", "Exposition::Post"]]
158
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.8ms)
159
+ Categorical::Tag Exists (0.4ms) SELECT 1 AS one FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 LIMIT 1 [["taggable_id", 1], ["taggable_type", "Exposition::Post"]]
160
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.4ms)
161
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml (11.7ms)
162
+  (0.4ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", "t"]]
163
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (23.8ms)
164
+ Completed 200 OK in 59ms (Views: 55.3ms | ActiveRecord: 2.9ms)
165
+
166
+
167
+ Started GET "/assets/exposition/application.self-8f19aaf36b36ca6b51a36609715d8d3eb66894ef841f3aaffd831fb6f86cbd59.css?body=1" for ::1 at 2016-03-09 10:37:12 -0500
168
+
169
+
170
+ Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-03-09 10:37:12 -0500
171
+
172
+
173
+ Started GET "/posts/test-title" for ::1 at 2016-03-09 10:37:49 -0500
174
+ Processing by Exposition::PostsController#show as HTML
175
+ Parameters: {"id"=>"test-title"}
176
+ Exposition::Post Load (0.6ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT 1 [["published", "t"], ["slug", "test-title"]]
177
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (30.8ms)
178
+ Completed 200 OK in 58ms (Views: 55.5ms | ActiveRecord: 0.6ms)
179
+
180
+
181
+ Started GET "/posts/test-title" for ::1 at 2016-03-09 10:38:08 -0500
182
+ Processing by Exposition::PostsController#show as HTML
183
+ Parameters: {"id"=>"test-title"}
184
+ Exposition::Post Load (0.7ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT 1 [["published", "t"], ["slug", "test-title"]]
185
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (30.1ms)
186
+ Completed 200 OK in 61ms (Views: 59.0ms | ActiveRecord: 0.7ms)
187
+
188
+
189
+ Started GET "/assets/exposition/application.self-8f19aaf36b36ca6b51a36609715d8d3eb66894ef841f3aaffd831fb6f86cbd59.css?body=1" for ::1 at 2016-03-09 10:38:08 -0500
190
+
191
+
192
+ Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-03-09 10:38:08 -0500
193
+
194
+
195
+ Started GET "/admin/posts/another-test/edit" for ::1 at 2016-03-09 10:38:13 -0500
196
+ Processing by Exposition::Admin::PostsController#edit as HTML
197
+ Parameters: {"id"=>"another-test"}
198
+ Exposition::User Load (0.6ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]]
199
+ Exposition::Post Load (0.5ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."slug" = $1 LIMIT 1 [["slug", "another-test"]]
200
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/shared/_error_handler.html.haml (0.2ms)
201
+ Exposition::User Load (0.5ms) SELECT "exposition_users".* FROM "exposition_users"
202
+ Categorical::Tag Load (0.5ms) SELECT "categorical_tags".* FROM "categorical_tags"
203
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/_form_fields.html.haml (8.2ms)
204
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/edit.html.haml within layouts/exposition/admin (18.1ms)
205
+ Completed 200 OK in 77ms (Views: 73.2ms | ActiveRecord: 2.0ms)
206
+
207
+
208
+ Started GET "/admin/posts/test-title/edit" for ::1 at 2016-03-09 10:38:16 -0500
209
+ Processing by Exposition::Admin::PostsController#edit as HTML
210
+ Parameters: {"id"=>"test-title"}
211
+ Exposition::User Load (0.5ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]]
212
+ Exposition::Post Load (0.6ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."slug" = $1 LIMIT 1 [["slug", "test-title"]]
213
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/shared/_error_handler.html.haml (0.1ms)
214
+ Exposition::User Load (0.5ms) SELECT "exposition_users".* FROM "exposition_users"
215
+ Categorical::Tag Load (0.4ms) SELECT "categorical_tags".* FROM "categorical_tags"
216
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/_form_fields.html.haml (6.1ms)
217
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/edit.html.haml within layouts/exposition/admin (14.3ms)
218
+ Completed 200 OK in 54ms (Views: 50.2ms | ActiveRecord: 2.1ms)
219
+
220
+
221
+ Started PATCH "/admin/posts/test-title" for ::1 at 2016-03-09 10:38:27 -0500
222
+ Processing by Exposition::Admin::PostsController#update as HTML
223
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"ZVi8R9raWzv7VhkqTUytXFH4rt5yLZD1fz+fQjuH1UVYr0JlKDEiaDYtPfRqBQiT5BMTBFEWOTScss/MxXDPFA==", "post"=>{"title"=>"Test Title", "summary"=>"## H2\r\n###H3\r\n####H4\r\n#####H5\r\n######H6 \r\n\r\n* Blocks\r\n* Modules\r\n* Difference between including and extending Modules\r\n* Difference between instance and class methods\r\n\r\n## Demonstration\r\n\r\nOne of the most common problems that seem to naturally arise in code is handling objects that share a _role_. This tends to be an issue that is not immediately apparent, but as the application grows it begins to present itself. Let's illustrate this with a concrete example taken from the code used in this blog. A lot of this code will be ActiveRecord syntax, but the underlying concepts can be applied to plain old Ruby objects as well.", "body"=>"### Prerequisites \r\n\r\n* Blocks\r\n* Modules\r\n* Difference between including and extending Modules\r\n* Difference between instance and class methods\r\n\r\n### Demonstration\r\n\r\nOne of the most common problems that seem to naturally arise in code is handling objects that share a _role_. This tends to be an issue that is not immediately apparent, but as the application grows it begins to present itself. Let's illustrate this with a concrete example taken from the code used in this blog. A lot of this code will be ActiveRecord syntax, but the underlying concepts can be applied to plain old Ruby objects as well. When laying out out the code for the blog we have objects for `Posts` and `BookReviews` that look like the following:\r\n\r\n\r\n```ruby\r\nclass Post < ActiveRecord::Base\r\n belongs_to :author, class_name: 'User'\r\n\r\n validates_presence_of :title, :body, :author\r\n validates_length_of :title, maximum: 244\r\n validates_presence_of :author\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n before_save :set_published_at_date\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n def self.published\r\n where(published: true)\r\n end\r\n\r\n def self.sorted_by_published_date\r\n order(published_at: :desc)\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\n\r\n def set_published_at_date\r\n if published_changed?(from: false, to: true)\r\n self.published_at = Date.today\r\n end\r\n end\r\nend\r\n```\r\n\r\n```ruby\r\nclass BookReview < ActiveRecord::Base\r\n belongs_to :author, class_name: 'User'\r\n\r\n validates_presence_of :book_title, :body, :book_author\r\n validates_length_of :book_title, :book_author, maximum: 244\r\n validates_presence_of :author\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n before_save :set_published_at_date\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n def self.published\r\n where(published: true)\r\n end\r\n\r\n def self.sorted_by_published_date\r\n order(published_at: :desc)\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\n\r\n def set_published_at_date\r\n if published_changed?(from: false, to: true)\r\n self.published_at = Date.today\r\n end\r\n end\r\nend\r\n```\r\n\r\nLet's go through this code a bit. You'll notice that despite being two different objects, they have quite a bit of behavior in common. To start, they both belong to an Author and validate that an author is present. Additionally they both have slugs for friendly urls, a call to the method `#parameterize_slug` to ensure the slug is URL friendly, and some validations to ensure the URL is present, unique, and it fits in the DB. Finally both of these objects can be marked as published and have scopes for filtering based on whether they're published or not.\r\n\r\nLooking at this code we can see a lot of duplicate code. Both of these objects share similar roles and these roles have the same behavior. You could say they're both _sluggable_, _publishable_, and _authorable_. To refactor this duplicate code we should use Ruby's [module](http://ruby-doc.org/core-2.2.0/Module.html \"Ruby Module\"). Ruby's module will allow us to 'mixin' common code to objects that share roles. Let's start with the code that makes an object play the _authorable_ role. \r\n\r\n```ruby\r\nmodule Authorable\r\n def self.included(base)\r\n base.class_eval do\r\n belongs_to :author, class_name: 'User'\r\n validates_presence_of :author\r\n end\r\n end\r\nend\r\n```\r\n\r\nThis is some dense code if you've never seen this pattern before, so let's step through it. The method `.included` is a built in hook method that gets called when a Ruby module is included in a class. The `base` argument is simply the included class. So by including the `Authorable` module into the `Post` class, the `.included` method will be called with the `Post` class set to `base`. Since `base` is now equal to `Post` we can open up the `Post` class can evaluate code using Ruby's `class_eval` method. The code inside the block will be evaluated as if it were in the `Post` class.\r\n\r\n**Note:** This pattern is so common that the Rails framework actually provides a special module for this type of refactoring that's called a [Concern](http://api.rubyonrails.org/classes/ActiveSupport/Concern.html \"Rails Concern\"). Feel free to use this module if you like, however I'm using the traditional way so we can use it without ActiveSupport.\r\n\r\nNow that we lumped all the code related to making an object play the _authorable_ role into the `Authorable` module, let's rewrite our `Post` and `BookReview` classes to use our new module.\r\n\r\n```ruby\r\nclass Post < ActiveRecord::Base\r\n include Authorable\r\n\r\n validates_presence_of :title, :body, :author\r\n validates_length_of :title, maximum: 244\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n before_save :set_published_at_date\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n def self.published\r\n where(published: true)\r\n end\r\n\r\n def self.sorted_by_published_date\r\n order(published_at: :desc)\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\n\r\n def set_published_at_date\r\n if published_changed?(from: false, to: true)\r\n self.published_at = Date.today\r\n end\r\n end\r\nend\r\n```\r\n\r\n```ruby\r\nclass BookReview < ActiveRecord::Base\r\n include Authorable\r\n\r\n validates_presence_of :book_title, :body, :book_author\r\n validates_length_of :book_title, :book_author, maximum: 244\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n before_save :set_published_at_date\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n def self.published\r\n where(published: true)\r\n end\r\n\r\n def self.sorted_by_published_date\r\n order(published_at: :desc)\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\n\r\n def set_published_at_date\r\n if published_changed?(from: false, to: true)\r\n self.published_at = Date.today\r\n end\r\n end\r\nend\r\n```\r\nIn the end we removed the duplication, but more importantly we learned a pattern that we can apply to the other roles these two objects have in common. Let's next tackle the common code that makes these objects _publishable_. Again, we'll start by creating a new `Publishable` module to put code for our _publishable_ role. \r\n\r\n```ruby\r\nmodule Publishable\r\n module ClassMethods\r\n def published\r\n where(published: true)\r\n end\r\n\r\n def sorted_by_published_date\r\n order(published_at: :desc)\r\n end\r\n end\r\n\r\n def self.included(base)\r\n base.extend(ClassMethods)\r\n base.class_eval do\r\n before_save :set_published_at_date\r\n end\r\n end\r\n\r\n def css_classes\r\n if published?\r\n return \"published\"\r\n else\r\n return \"not-published\"\r\n end\r\n end\r\n\r\n private\r\n\r\n def set_published_at_date\r\n if published_changed?(from: false, to: true)\r\n self.published_at = Date.today\r\n end\r\n end\r\nend\r\n```\r\n\r\nYou'll notice this module has a bit more to it than the `Authorable` module. Let's walk through the new changes. Right away you see that we have a module within the `Publishable` module called `ClassMethods`. We're going to use the `ClassMethods` module as a container for defining methods that we want to add as class methods (as opposed to instance methods) to our _publishable_ objects. In our `.included` hook method that we used before, you'll notice that in addition to evaluating code we also `extend` our base class with the `ClassMethods` module. This adds (or mixes in) the methods in `ClassMethods` with the base or _publishable_ class, but since we're using `extend` they're added as class methods, not instance methods. Lastly, we have the `#css_classes` and `#set_published_at_date` methods. These are instance methods and will automatically be included as instance level methods when the module is included. Once again let's refactor our `Post` and `BookReview` classes.\r\n\r\n```ruby\r\nclass Post < ActiveRecord::Base\r\n include Authorable\r\n include Publishable\r\n\r\n validates_presence_of :title, :body, :author\r\n validates_length_of :title, maximum: 244\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\nend\r\n```\r\n\r\n```ruby\r\nclass BookReview < ActiveRecord::Base\r\n include Authorable\r\n include Publishable\r\n\r\n validates_presence_of :book_title, :body, :book_author\r\n validates_length_of :book_title, :book_author, maximum: 244\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\nend\r\n```\r\n\r\nThings are really starting to get cleaned up and duplicate lines of code are disappearing. Let's use the same pattern one last time for removing the duplication when it comes to the _sluggable_ role. Once again we'll create a `Sluggable` module to correspond to the _sluggable_ role and add the related code to the module. \r\n\r\n```ruby\r\nmodule Sluggable\r\n def self.included(base)\r\n base.class_eval do\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n end\r\n end\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\nend\r\n```\r\n\r\nBy now you are familiar with everything this module is doing. We are evaluating some code in the context of the included _sluggable_ class within `class_eval` block and moving the instance methods relevant to the _sluggable_ role into the module which will be added to the to the _sluggable_ objects that include this module. Let's look at the final version of our `Post` and `BookReview` classes.\r\n\r\n```ruby\r\nclass Post < ActiveRecord::Base\r\n include Authorable\r\n include Publishable\r\n include Sluggable\r\n\r\n validates_presence_of :title, :body, :author\r\n validates_length_of :title, maximum: 244\r\nend\r\n```\r\n\r\n```ruby\r\nclass BookReview < ActiveRecord::Base\r\n include Authorable\r\n include Publishable\r\n include Sluggable\r\n\r\n validates_presence_of :book_title, :body, :book_author\r\n validates_length_of :book_title, :book_author, maximum: 244\r\nend\r\n```\r\n\r\nThose classes are really compact now. We also now have the neat side effect that when we add other models to our blog, adding roles will be trivially easy. For example, if we decide we want to add a Tags model, all we have to do is include the functionality we want. Tags don't need to play the roles of _authorable_ or _publishable_, but perhaps we want each Tag to have its own URL. To do this we can simply include the `Sluggable` module and be done with it (since this is technically a DB backed application we'll need to adjust the DB accordingly as well).\r\n\r\n## Warnings\r\nWhile this pattern is powerful there are trade-offs we have to consider. When including modules, the functionality behind each role is now not as apparent. Someone who isn't familiar with your code might wonder where all the functionality is hidden. This also adds a bit of cognitive load for the programmer as they now have code for one object in 3 additional different places they must consider. When refactoring out into modules, or anytime when using inheritance, you'll want to make sure you're constantly asking yourself, _will other programmers be able to easily navigate the code and find what they need_. \r\n\r\nWe could, for example, create another module called `Broadcastable` that would look something like:\r\n\r\n```ruby\r\nmodule Broadcastable\r\n include Authorable\r\n include Publishable\r\n include Sluggable\r\nend\r\n```\r\n\r\nAnd then include this in our `Post` and `BookReview` classes. While this does DRY up the code a bit, I feel that it adds too much complexity and cognitive load. Its not quite as clear as to what `Broadcastable` does and adds another layer in the inheritance tree that programmers must process. \r\n\r\nAnother thing to be careful with is using this pattern simply to remove duplicate code. Its important to consider that the purpose of the duplicate code is the same as opposed to having duplicate code purely because of coincidence. If the purpose is aligned, then its much more likely the future changes will be compatible with all involved objects. If the duplicate code exists between objects coincidentally, then its much more likely that the duplicate code may diverge in the future. Sometimes you might even want to hold off refactoring until further down the line, when the true roles of objects become more clear. \r\n\r\nWith these warnings in mind, factoring out common code that objects share by virtue of having a role into a module is a great way to organize shared behavior. \r\n\r\n## See More:\r\nTo see how to test this pattern, you can view the source code for this blog. It makes use of rspec's Shared Examples. In minitest you would simply use modules!\r\n\r\n* [Source code for this blog](https://github.com/jklina/joshklina.com \"joshklina.com source code\")\r\n* [Eloquent Ruby by Russ Olsen](http://amzn.to/1R2mkFA \"Eloquent Ruby\")\r\n* [Practical Object-Oriented Design in Ruby: An Agile Primer by Sandi Metz](http://amzn.to/1R2muN9 \"Eloquent Ruby\")\r\n* [Rails Concerns](http://api.rubyonrails.org/classes/ActiveSupport/Concern.html \"Rails Concerns\")\r\n", "author_id"=>"1", "slug"=>"test-title", "tag_ids"=>[""], "published"=>"1"}, "commit"=>"Update Post", "id"=>"test-title"}
224
+ Exposition::User Load (0.3ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]]
225
+ Exposition::Post Load (0.6ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."slug" = $1 LIMIT 1 [["slug", "test-title"]]
226
+  (0.2ms) BEGIN
227
+ Categorical::Tag Load (0.9ms) SELECT "categorical_tags".* FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 [["taggable_id", 1], ["taggable_type", "Exposition::Post"]]
228
+ CACHE (0.0ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]]
229
+ Exposition::Post Exists (0.5ms) SELECT 1 AS one FROM "exposition_posts" WHERE (LOWER("exposition_posts"."slug") = LOWER('test-title') AND "exposition_posts"."id" != 1) LIMIT 1
230
+ SQL (2.4ms) UPDATE "exposition_posts" SET "body" = $1, "updated_at" = $2 WHERE "exposition_posts"."id" = $3 [["body", "### Prerequisites \r\n\r\n* Blocks\r\n* Modules\r\n* Difference between including and extending Modules\r\n* Difference between instance and class methods\r\n\r\n### Demonstration\r\n\r\nOne of the most common problems that seem to naturally arise in code is handling objects that share a _role_. This tends to be an issue that is not immediately apparent, but as the application grows it begins to present itself. Let's illustrate this with a concrete example taken from the code used in this blog. A lot of this code will be ActiveRecord syntax, but the underlying concepts can be applied to plain old Ruby objects as well. When laying out out the code for the blog we have objects for `Posts` and `BookReviews` that look like the following:\r\n\r\n\r\n```ruby\r\nclass Post < ActiveRecord::Base\r\n belongs_to :author, class_name: 'User'\r\n\r\n validates_presence_of :title, :body, :author\r\n validates_length_of :title, maximum: 244\r\n validates_presence_of :author\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n before_save :set_published_at_date\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n def self.published\r\n where(published: true)\r\n end\r\n\r\n def self.sorted_by_published_date\r\n order(published_at: :desc)\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\n\r\n def set_published_at_date\r\n if published_changed?(from: false, to: true)\r\n self.published_at = Date.today\r\n end\r\n end\r\nend\r\n```\r\n\r\n```ruby\r\nclass BookReview < ActiveRecord::Base\r\n belongs_to :author, class_name: 'User'\r\n\r\n validates_presence_of :book_title, :body, :book_author\r\n validates_length_of :book_title, :book_author, maximum: 244\r\n validates_presence_of :author\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n before_save :set_published_at_date\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n def self.published\r\n where(published: true)\r\n end\r\n\r\n def self.sorted_by_published_date\r\n order(published_at: :desc)\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\n\r\n def set_published_at_date\r\n if published_changed?(from: false, to: true)\r\n self.published_at = Date.today\r\n end\r\n end\r\nend\r\n```\r\n\r\nLet's go through this code a bit. You'll notice that despite being two different objects, they have quite a bit of behavior in common. To start, they both belong to an Author and validate that an author is present. Additionally they both have slugs for friendly urls, a call to the method `#parameterize_slug` to ensure the slug is URL friendly, and some validations to ensure the URL is present, unique, and it fits in the DB. Finally both of these objects can be marked as published and have scopes for filtering based on whether they're published or not.\r\n\r\nLooking at this code we can see a lot of duplicate code. Both of these objects share similar roles and these roles have the same behavior. You could say they're both _sluggable_, _publishable_, and _authorable_. To refactor this duplicate code we should use Ruby's [module](http://ruby-doc.org/core-2.2.0/Module.html \"Ruby Module\"). Ruby's module will allow us to 'mixin' common code to objects that share roles. Let's start with the code that makes an object play the _authorable_ role. \r\n\r\n```ruby\r\nmodule Authorable\r\n def self.included(base)\r\n base.class_eval do\r\n belongs_to :author, class_name: 'User'\r\n validates_presence_of :author\r\n end\r\n end\r\nend\r\n```\r\n\r\nThis is some dense code if you've never seen this pattern before, so let's step through it. The method `.included` is a built in hook method that gets called when a Ruby module is included in a class. The `base` argument is simply the included class. So by including the `Authorable` module into the `Post` class, the `.included` method will be called with the `Post` class set to `base`. Since `base` is now equal to `Post` we can open up the `Post` class can evaluate code using Ruby's `class_eval` method. The code inside the block will be evaluated as if it were in the `Post` class.\r\n\r\n**Note:** This pattern is so common that the Rails framework actually provides a special module for this type of refactoring that's called a [Concern](http://api.rubyonrails.org/classes/ActiveSupport/Concern.html \"Rails Concern\"). Feel free to use this module if you like, however I'm using the traditional way so we can use it without ActiveSupport.\r\n\r\nNow that we lumped all the code related to making an object play the _authorable_ role into the `Authorable` module, let's rewrite our `Post` and `BookReview` classes to use our new module.\r\n\r\n```ruby\r\nclass Post < ActiveRecord::Base\r\n include Authorable\r\n\r\n validates_presence_of :title, :body, :author\r\n validates_length_of :title, maximum: 244\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n before_save :set_published_at_date\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n def self.published\r\n where(published: true)\r\n end\r\n\r\n def self.sorted_by_published_date\r\n order(published_at: :desc)\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\n\r\n def set_published_at_date\r\n if published_changed?(from: false, to: true)\r\n self.published_at = Date.today\r\n end\r\n end\r\nend\r\n```\r\n\r\n```ruby\r\nclass BookReview < ActiveRecord::Base\r\n include Authorable\r\n\r\n validates_presence_of :book_title, :body, :book_author\r\n validates_length_of :book_title, :book_author, maximum: 244\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n before_save :set_published_at_date\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n def self.published\r\n where(published: true)\r\n end\r\n\r\n def self.sorted_by_published_date\r\n order(published_at: :desc)\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\n\r\n def set_published_at_date\r\n if published_changed?(from: false, to: true)\r\n self.published_at = Date.today\r\n end\r\n end\r\nend\r\n```\r\nIn the end we removed the duplication, but more importantly we learned a pattern that we can apply to the other roles these two objects have in common. Let's next tackle the common code that makes these objects _publishable_. Again, we'll start by creating a new `Publishable` module to put code for our _publishable_ role. \r\n\r\n```ruby\r\nmodule Publishable\r\n module ClassMethods\r\n def published\r\n where(published: true)\r\n end\r\n\r\n def sorted_by_published_date\r\n order(published_at: :desc)\r\n end\r\n end\r\n\r\n def self.included(base)\r\n base.extend(ClassMethods)\r\n base.class_eval do\r\n before_save :set_published_at_date\r\n end\r\n end\r\n\r\n def css_classes\r\n if published?\r\n return \"published\"\r\n else\r\n return \"not-published\"\r\n end\r\n end\r\n\r\n private\r\n\r\n def set_published_at_date\r\n if published_changed?(from: false, to: true)\r\n self.published_at = Date.today\r\n end\r\n end\r\nend\r\n```\r\n\r\nYou'll notice this module has a bit more to it than the `Authorable` module. Let's walk through the new changes. Right away you see that we have a module within the `Publishable` module called `ClassMethods`. We're going to use the `ClassMethods` module as a container for defining methods that we want to add as class methods (as opposed to instance methods) to our _publishable_ objects. In our `.included` hook method that we used before, you'll notice that in addition to evaluating code we also `extend` our base class with the `ClassMethods` module. This adds (or mixes in) the methods in `ClassMethods` with the base or _publishable_ class, but since we're using `extend` they're added as class methods, not instance methods. Lastly, we have the `#css_classes` and `#set_published_at_date` methods. These are instance methods and will automatically be included as instance level methods when the module is included. Once again let's refactor our `Post` and `BookReview` classes.\r\n\r\n```ruby\r\nclass Post < ActiveRecord::Base\r\n include Authorable\r\n include Publishable\r\n\r\n validates_presence_of :title, :body, :author\r\n validates_length_of :title, maximum: 244\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\nend\r\n```\r\n\r\n```ruby\r\nclass BookReview < ActiveRecord::Base\r\n include Authorable\r\n include Publishable\r\n\r\n validates_presence_of :book_title, :body, :book_author\r\n validates_length_of :book_title, :book_author, maximum: 244\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\nend\r\n```\r\n\r\nThings are really starting to get cleaned up and duplicate lines of code are disappearing. Let's use the same pattern one last time for removing the duplication when it comes to the _sluggable_ role. Once again we'll create a `Sluggable` module to correspond to the _sluggable_ role and add the related code to the module. \r\n\r\n```ruby\r\nmodule Sluggable\r\n def self.included(base)\r\n base.class_eval do\r\n validates_presence_of :slug\r\n validates_uniqueness_of :slug, case_sensitive: false\r\n validates_length_of :slug, maximum: 244\r\n\r\n before_validation :parameterize_slug\r\n end\r\n end\r\n\r\n def to_param\r\n slug\r\n end\r\n\r\n private\r\n\r\n def parameterize_slug\r\n self.slug = slug.to_s\r\n self.slug = slug.parameterize\r\n end\r\nend\r\n```\r\n\r\nBy now you are familiar with everything this module is doing. We are evaluating some code in the context of the included _sluggable_ class within `class_eval` block and moving the instance methods relevant to the _sluggable_ role into the module which will be added to the to the _sluggable_ objects that include this module. Let's look at the final version of our `Post` and `BookReview` classes.\r\n\r\n```ruby\r\nclass Post < ActiveRecord::Base\r\n include Authorable\r\n include Publishable\r\n include Sluggable\r\n\r\n validates_presence_of :title, :body, :author\r\n validates_length_of :title, maximum: 244\r\nend\r\n```\r\n\r\n```ruby\r\nclass BookReview < ActiveRecord::Base\r\n include Authorable\r\n include Publishable\r\n include Sluggable\r\n\r\n validates_presence_of :book_title, :body, :book_author\r\n validates_length_of :book_title, :book_author, maximum: 244\r\nend\r\n```\r\n\r\nThose classes are really compact now. We also now have the neat side effect that when we add other models to our blog, adding roles will be trivially easy. For example, if we decide we want to add a Tags model, all we have to do is include the functionality we want. Tags don't need to play the roles of _authorable_ or _publishable_, but perhaps we want each Tag to have its own URL. To do this we can simply include the `Sluggable` module and be done with it (since this is technically a DB backed application we'll need to adjust the DB accordingly as well).\r\n\r\n## Warnings\r\nWhile this pattern is powerful there are trade-offs we have to consider. When including modules, the functionality behind each role is now not as apparent. Someone who isn't familiar with your code might wonder where all the functionality is hidden. This also adds a bit of cognitive load for the programmer as they now have code for one object in 3 additional different places they must consider. When refactoring out into modules, or anytime when using inheritance, you'll want to make sure you're constantly asking yourself, _will other programmers be able to easily navigate the code and find what they need_. \r\n\r\nWe could, for example, create another module called `Broadcastable` that would look something like:\r\n\r\n```ruby\r\nmodule Broadcastable\r\n include Authorable\r\n include Publishable\r\n include Sluggable\r\nend\r\n```\r\n\r\nAnd then include this in our `Post` and `BookReview` classes. While this does DRY up the code a bit, I feel that it adds too much complexity and cognitive load. Its not quite as clear as to what `Broadcastable` does and adds another layer in the inheritance tree that programmers must process. \r\n\r\nAnother thing to be careful with is using this pattern simply to remove duplicate code. Its important to consider that the purpose of the duplicate code is the same as opposed to having duplicate code purely because of coincidence. If the purpose is aligned, then its much more likely the future changes will be compatible with all involved objects. If the duplicate code exists between objects coincidentally, then its much more likely that the duplicate code may diverge in the future. Sometimes you might even want to hold off refactoring until further down the line, when the true roles of objects become more clear. \r\n\r\nWith these warnings in mind, factoring out common code that objects share by virtue of having a role into a module is a great way to organize shared behavior. \r\n\r\n## See More:\r\nTo see how to test this pattern, you can view the source code for this blog. It makes use of rspec's Shared Examples. In minitest you would simply use modules!\r\n\r\n* [Source code for this blog](https://github.com/jklina/joshklina.com \"joshklina.com source code\")\r\n* [Eloquent Ruby by Russ Olsen](http://amzn.to/1R2mkFA \"Eloquent Ruby\")\r\n* [Practical Object-Oriented Design in Ruby: An Agile Primer by Sandi Metz](http://amzn.to/1R2muN9 \"Eloquent Ruby\")\r\n* [Rails Concerns](http://api.rubyonrails.org/classes/ActiveSupport/Concern.html \"Rails Concerns\")\r\n"], ["updated_at", "2016-03-09 15:38:27.619581"], ["id", 1]]
231
+  (0.5ms) COMMIT
232
+ Redirected to http://localhost:3000/admin/posts
233
+ Completed 302 Found in 44ms (ActiveRecord: 5.4ms)
234
+
235
+
236
+ Started GET "/admin/posts" for ::1 at 2016-03-09 10:38:27 -0500
237
+ Processing by Exposition::Admin::PostsController#index as HTML
238
+ Exposition::User Load (0.4ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]]
239
+ Exposition::Post Load (1.2ms) SELECT "exposition_posts".* FROM "exposition_posts" ORDER BY "exposition_posts"."published_at" DESC LIMIT 25 OFFSET 0
240
+ CACHE (0.0ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]]
241
+ Categorical::Tag Load (0.4ms) SELECT "categorical_tags".* FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 [["taggable_id", 2], ["taggable_type", "Exposition::Post"]]
242
+ CACHE (0.0ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]]
243
+ Categorical::Tag Load (0.4ms) SELECT "categorical_tags".* FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 [["taggable_id", 1], ["taggable_type", "Exposition::Post"]]
244
+  (0.5ms) SELECT COUNT(*) FROM "exposition_posts"
245
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/index.html.haml within layouts/exposition/admin (24.3ms)
246
+ Completed 200 OK in 62ms (Views: 57.3ms | ActiveRecord: 2.9ms)
247
+
248
+
249
+ Started GET "/posts/test-title" for ::1 at 2016-03-09 10:38:33 -0500
250
+ Processing by Exposition::PostsController#show as HTML
251
+ Parameters: {"id"=>"test-title"}
252
+ Exposition::Post Load (1.1ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT 1 [["published", "t"], ["slug", "test-title"]]
253
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (22.6ms)
254
+ Completed 200 OK in 60ms (Views: 57.2ms | ActiveRecord: 1.1ms)
255
+
256
+
257
+ Started GET "/assets/exposition/application.self-8f19aaf36b36ca6b51a36609715d8d3eb66894ef841f3aaffd831fb6f86cbd59.css?body=1" for ::1 at 2016-03-09 10:38:33 -0500
258
+
259
+
260
+ Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-03-09 10:38:33 -0500
261
+
262
+
263
+ Started GET "/posts/test-title" for ::1 at 2016-03-09 10:40:57 -0500
264
+ Processing by Exposition::PostsController#show as HTML
265
+ Parameters: {"id"=>"test-title"}
266
+ Exposition::Post Load (0.7ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT 1 [["published", "t"], ["slug", "test-title"]]
267
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (29.1ms)
268
+ Completed 500 Internal Server Error in 434ms (ActiveRecord: 0.7ms)
269
+
270
+ ActionView::Template::Error (Undefined mixin 'modular-scale'.):
271
+ 2: %html
272
+ 3: %head
273
+ 4: %title= t('title')
274
+ 5: = stylesheet_link_tag "exposition/application"
275
+ 6: = csrf_meta_tags
276
+ 7: %meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0, maximum-scale=1.0"}
277
+ 8: %body
278
+ /Users/jklina/Development/exposition/app/assets/stylesheets/exposition/_layout.scss:18:in `modular-scale'
279
+ /Users/jklina/Development/exposition/app/assets/stylesheets/exposition/_layout.scss:18
280
+ /Users/jklina/Development/exposition/app/assets/stylesheets/exposition/application.scss:10
281
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:349:in `block in visit_mixin'
282
+ sass (3.4.21) lib/sass/stack.rb:98:in `block in with_mixin'
283
+ sass (3.4.21) lib/sass/stack.rb:115:in `with_frame'
284
+ sass (3.4.21) lib/sass/stack.rb:98:in `with_mixin'
285
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:347:in `visit_mixin'
286
+ sass (3.4.21) lib/sass/tree/visitors/base.rb:36:in `visit'
287
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:158:in `block in visit'
288
+ sass (3.4.21) lib/sass/stack.rb:79:in `block in with_base'
289
+ sass (3.4.21) lib/sass/stack.rb:115:in `with_frame'
290
+ sass (3.4.21) lib/sass/stack.rb:79:in `with_base'
291
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:158:in `visit'
292
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:431:in `block (2 levels) in visit_rule'
293
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:431:in `map'
294
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:431:in `block in visit_rule'
295
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:179:in `with_environment'
296
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:429:in `visit_rule'
297
+ sass (3.4.21) lib/sass/tree/visitors/base.rb:36:in `visit'
298
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:158:in `block in visit'
299
+ sass (3.4.21) lib/sass/stack.rb:79:in `block in with_base'
300
+ sass (3.4.21) lib/sass/stack.rb:115:in `with_frame'
301
+ sass (3.4.21) lib/sass/stack.rb:79:in `with_base'
302
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:158:in `visit'
303
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:326:in `block (2 levels) in visit_import'
304
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:326:in `map'
305
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:326:in `block in visit_import'
306
+ sass (3.4.21) lib/sass/stack.rb:88:in `block in with_import'
307
+ sass (3.4.21) lib/sass/stack.rb:115:in `with_frame'
308
+ sass (3.4.21) lib/sass/stack.rb:88:in `with_import'
309
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:323:in `visit_import'
310
+ sass (3.4.21) lib/sass/tree/visitors/base.rb:36:in `visit'
311
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:158:in `block in visit'
312
+ sass (3.4.21) lib/sass/stack.rb:79:in `block in with_base'
313
+ sass (3.4.21) lib/sass/stack.rb:115:in `with_frame'
314
+ sass (3.4.21) lib/sass/stack.rb:79:in `with_base'
315
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:158:in `visit'
316
+ sass (3.4.21) lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
317
+ sass (3.4.21) lib/sass/tree/visitors/base.rb:52:in `map'
318
+ sass (3.4.21) lib/sass/tree/visitors/base.rb:52:in `visit_children'
319
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:167:in `block in visit_children'
320
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:179:in `with_environment'
321
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:166:in `visit_children'
322
+ sass (3.4.21) lib/sass/tree/visitors/base.rb:36:in `block in visit'
323
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:186:in `visit_root'
324
+ sass (3.4.21) lib/sass/tree/visitors/base.rb:36:in `visit'
325
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:157:in `visit'
326
+ sass (3.4.21) lib/sass/tree/visitors/perform.rb:8:in `visit'
327
+ sass (3.4.21) lib/sass/tree/root_node.rb:36:in `css_tree'
328
+ sass (3.4.21) lib/sass/tree/root_node.rb:20:in `render'
329
+ sass (3.4.21) lib/sass/engine.rb:278:in `render'
330
+ sprockets (3.5.2) lib/sprockets/sass_processor.rb:74:in `block in call'
331
+ sprockets (3.5.2) lib/sprockets/utils.rb:154:in `module_include'
332
+ sprockets (3.5.2) lib/sprockets/sass_processor.rb:73:in `call'
333
+ sprockets (3.5.2) lib/sprockets/sass_processor.rb:30:in `call'
334
+ sprockets (3.5.2) lib/sprockets/processor_utils.rb:75:in `call_processor'
335
+ sprockets (3.5.2) lib/sprockets/processor_utils.rb:57:in `block in call_processors'
336
+ sprockets (3.5.2) lib/sprockets/processor_utils.rb:56:in `reverse_each'
337
+ sprockets (3.5.2) lib/sprockets/processor_utils.rb:56:in `call_processors'
338
+ sprockets (3.5.2) lib/sprockets/loader.rb:134:in `load_from_unloaded'
339
+ sprockets (3.5.2) lib/sprockets/loader.rb:60:in `block in load'
340
+ sprockets (3.5.2) lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
341
+ sprockets (3.5.2) lib/sprockets/loader.rb:44:in `load'
342
+ sprockets (3.5.2) lib/sprockets/cached_environment.rb:20:in `block in initialize'
343
+ sprockets (3.5.2) lib/sprockets/cached_environment.rb:47:in `yield'
344
+ sprockets (3.5.2) lib/sprockets/cached_environment.rb:47:in `load'
345
+ sprockets (3.5.2) lib/sprockets/bundle.rb:23:in `block in call'
346
+ sprockets (3.5.2) lib/sprockets/utils.rb:183:in `dfs'
347
+ sprockets (3.5.2) lib/sprockets/bundle.rb:24:in `call'
348
+ sprockets (3.5.2) lib/sprockets/processor_utils.rb:75:in `call_processor'
349
+ sprockets (3.5.2) lib/sprockets/processor_utils.rb:57:in `block in call_processors'
350
+ sprockets (3.5.2) lib/sprockets/processor_utils.rb:56:in `reverse_each'
351
+ sprockets (3.5.2) lib/sprockets/processor_utils.rb:56:in `call_processors'
352
+ sprockets (3.5.2) lib/sprockets/loader.rb:134:in `load_from_unloaded'
353
+ sprockets (3.5.2) lib/sprockets/loader.rb:60:in `block in load'
354
+ sprockets (3.5.2) lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
355
+ sprockets (3.5.2) lib/sprockets/loader.rb:44:in `load'
356
+ sprockets (3.5.2) lib/sprockets/cached_environment.rb:20:in `block in initialize'
357
+ sprockets (3.5.2) lib/sprockets/cached_environment.rb:47:in `yield'
358
+ sprockets (3.5.2) lib/sprockets/cached_environment.rb:47:in `load'
359
+ sprockets (3.5.2) lib/sprockets/base.rb:66:in `find_asset'
360
+ sprockets (3.5.2) lib/sprockets/base.rb:92:in `[]'
361
+ sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:342:in `find_asset'
362
+ sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:334:in `find_debug_asset'
363
+ sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:217:in `block in lookup_debug_asset'
364
+ sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:230:in `block in resolve_asset'
365
+ sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:229:in `each'
366
+ sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:229:in `detect'
367
+ sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:229:in `resolve_asset'
368
+ sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:216:in `lookup_debug_asset'
369
+ sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:158:in `block in stylesheet_link_tag'
370
+ sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:157:in `map'
371
+ sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:157:in `stylesheet_link_tag'
372
+ /Users/jklina/Development/exposition/app/views/layouts/exposition/application.html.haml:5:in `___sers_jklina__evelopment_exposition_app_views_layouts_exposition_application_html_haml__2103793355481475315_70231290603520'
373
+ actionview (4.2.5) lib/action_view/template.rb:145:in `block in render'
374
+ activesupport (4.2.5) lib/active_support/notifications.rb:166:in `instrument'
375
+ actionview (4.2.5) lib/action_view/template.rb:333:in `instrument'
376
+ actionview (4.2.5) lib/action_view/template.rb:143:in `render'
377
+ actionview (4.2.5) lib/action_view/renderer/template_renderer.rb:66:in `render_with_layout'
378
+ actionview (4.2.5) lib/action_view/renderer/template_renderer.rb:52:in `render_template'
379
+ actionview (4.2.5) lib/action_view/renderer/template_renderer.rb:14:in `render'
380
+ actionview (4.2.5) lib/action_view/renderer/renderer.rb:42:in `render_template'
381
+ actionview (4.2.5) lib/action_view/renderer/renderer.rb:23:in `render'
382
+ actionview (4.2.5) lib/action_view/rendering.rb:100:in `_render_template'
383
+ actionpack (4.2.5) lib/action_controller/metal/streaming.rb:217:in `_render_template'
384
+ actionview (4.2.5) lib/action_view/rendering.rb:83:in `render_to_body'
385
+ actionpack (4.2.5) lib/action_controller/metal/rendering.rb:32:in `render_to_body'
386
+ actionpack (4.2.5) lib/action_controller/metal/renderers.rb:37:in `render_to_body'
387
+ actionpack (4.2.5) lib/abstract_controller/rendering.rb:25:in `render'
388
+ actionpack (4.2.5) lib/action_controller/metal/rendering.rb:16:in `render'
389
+ actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
390
+ activesupport (4.2.5) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
391
+ /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
392
+ activesupport (4.2.5) lib/active_support/core_ext/benchmark.rb:12:in `ms'
393
+ actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
394
+ actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
395
+ activerecord (4.2.5) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
396
+ actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:43:in `render'
397
+ actionpack (4.2.5) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
398
+ actionpack (4.2.5) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
399
+ actionpack (4.2.5) lib/abstract_controller/base.rb:198:in `process_action'
400
+ actionpack (4.2.5) lib/action_controller/metal/rendering.rb:10:in `process_action'
401
+ actionpack (4.2.5) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
402
+ activesupport (4.2.5) lib/active_support/callbacks.rb:117:in `call'
403
+ activesupport (4.2.5) lib/active_support/callbacks.rb:117:in `call'
404
+ activesupport (4.2.5) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
405
+ activesupport (4.2.5) lib/active_support/callbacks.rb:505:in `call'
406
+ activesupport (4.2.5) lib/active_support/callbacks.rb:505:in `call'
407
+ activesupport (4.2.5) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
408
+ activesupport (4.2.5) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
409
+ activesupport (4.2.5) lib/active_support/callbacks.rb:81:in `run_callbacks'
410
+ actionpack (4.2.5) lib/abstract_controller/callbacks.rb:19:in `process_action'
411
+ actionpack (4.2.5) lib/action_controller/metal/rescue.rb:29:in `process_action'
412
+ actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
413
+ activesupport (4.2.5) lib/active_support/notifications.rb:164:in `block in instrument'
414
+ activesupport (4.2.5) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
415
+ activesupport (4.2.5) lib/active_support/notifications.rb:164:in `instrument'
416
+ actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
417
+ actionpack (4.2.5) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
418
+ activerecord (4.2.5) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
419
+ actionpack (4.2.5) lib/abstract_controller/base.rb:137:in `process'
420
+ actionview (4.2.5) lib/action_view/rendering.rb:30:in `process'
421
+ actionpack (4.2.5) lib/action_controller/metal.rb:196:in `dispatch'
422
+ actionpack (4.2.5) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
423
+ actionpack (4.2.5) lib/action_controller/metal.rb:237:in `block in action'
424
+ actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:76:in `call'
425
+ actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:76:in `dispatch'
426
+ actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:45:in `serve'
427
+ actionpack (4.2.5) lib/action_dispatch/journey/router.rb:43:in `block in serve'
428
+ actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `each'
429
+ actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `serve'
430
+ actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:817:in `call'
431
+ railties (4.2.5) lib/rails/engine.rb:518:in `call'
432
+ railties (4.2.5) lib/rails/railtie.rb:194:in `public_send'
433
+ railties (4.2.5) lib/rails/railtie.rb:194:in `method_missing'
434
+ actionpack (4.2.5) lib/action_dispatch/routing/mapper.rb:51:in `serve'
435
+ actionpack (4.2.5) lib/action_dispatch/journey/router.rb:43:in `block in serve'
436
+ actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `each'
437
+ actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `serve'
438
+ actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:817:in `call'
439
+ rack (1.6.4) lib/rack/etag.rb:24:in `call'
440
+ rack (1.6.4) lib/rack/conditionalget.rb:25:in `call'
441
+ rack (1.6.4) lib/rack/head.rb:13:in `call'
442
+ actionpack (4.2.5) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
443
+ actionpack (4.2.5) lib/action_dispatch/middleware/flash.rb:260:in `call'
444
+ rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
445
+ rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
446
+ actionpack (4.2.5) lib/action_dispatch/middleware/cookies.rb:560:in `call'
447
+ activerecord (4.2.5) lib/active_record/query_cache.rb:36:in `call'
448
+ activerecord (4.2.5) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
449
+ activerecord (4.2.5) lib/active_record/migration.rb:377:in `call'
450
+ actionpack (4.2.5) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
451
+ activesupport (4.2.5) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
452
+ activesupport (4.2.5) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
453
+ activesupport (4.2.5) lib/active_support/callbacks.rb:81:in `run_callbacks'
454
+ actionpack (4.2.5) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
455
+ actionpack (4.2.5) lib/action_dispatch/middleware/reloader.rb:73:in `call'
456
+ actionpack (4.2.5) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
457
+ actionpack (4.2.5) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
458
+ actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
459
+ railties (4.2.5) lib/rails/rack/logger.rb:38:in `call_app'
460
+ railties (4.2.5) lib/rails/rack/logger.rb:20:in `block in call'
461
+ activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `block in tagged'
462
+ activesupport (4.2.5) lib/active_support/tagged_logging.rb:26:in `tagged'
463
+ activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `tagged'
464
+ railties (4.2.5) lib/rails/rack/logger.rb:20:in `call'
465
+ actionpack (4.2.5) lib/action_dispatch/middleware/request_id.rb:21:in `call'
466
+ rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
467
+ rack (1.6.4) lib/rack/runtime.rb:18:in `call'
468
+ activesupport (4.2.5) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
469
+ rack (1.6.4) lib/rack/lock.rb:17:in `call'
470
+ actionpack (4.2.5) lib/action_dispatch/middleware/static.rb:116:in `call'
471
+ rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
472
+ railties (4.2.5) lib/rails/engine.rb:518:in `call'
473
+ railties (4.2.5) lib/rails/application.rb:165:in `call'
474
+ rack (1.6.4) lib/rack/lock.rb:17:in `call'
475
+ rack (1.6.4) lib/rack/content_length.rb:15:in `call'
476
+ rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
477
+ /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
478
+ /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
479
+ /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
480
+
481
+
482
+ Rendered /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_source.erb (12.9ms)
483
+ Rendered /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (5.1ms)
484
+ Rendered /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (2.1ms)
485
+ Rendered /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (76.5ms)
486
+
487
+
488
+ Started GET "/posts/test-title" for ::1 at 2016-03-09 10:41:29 -0500
489
+ Processing by Exposition::PostsController#show as HTML
490
+ Parameters: {"id"=>"test-title"}
491
+ Exposition::Post Load (1.3ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT 1 [["published", "t"], ["slug", "test-title"]]
492
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (32.3ms)
493
+ Completed 200 OK in 780ms (Views: 776.1ms | ActiveRecord: 1.3ms)
494
+
495
+
496
+ Started GET "/assets/exposition/application.self-a4451bd9952cffa298bc437ef0d7a70a0bd179bae6b179961a6f6dc0b15b7557.css?body=1" for ::1 at 2016-03-09 10:41:30 -0500
497
+
498
+
499
+ Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-03-09 10:41:30 -0500
500
+
501
+
502
+ Started GET "/posts/test-title" for ::1 at 2016-03-09 10:41:42 -0500
503
+ Processing by Exposition::PostsController#show as HTML
504
+ Parameters: {"id"=>"test-title"}
505
+ Exposition::Post Load (0.8ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT 1 [["published", "t"], ["slug", "test-title"]]
506
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (26.2ms)
507
+ Completed 200 OK in 588ms (Views: 585.6ms | ActiveRecord: 0.8ms)
508
+
509
+
510
+ Started GET "/assets/exposition/application.self-5b55adb8abd1219962976af272a6e05f79a94f51d0cb8405d4cc74dd4556565e.css?body=1" for ::1 at 2016-03-09 10:41:43 -0500
511
+
512
+
513
+ Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-03-09 10:41:43 -0500
514
+
515
+
516
+ Started GET "/posts/test-title" for ::1 at 2016-03-09 10:42:19 -0500
517
+ Processing by Exposition::PostsController#show as HTML
518
+ Parameters: {"id"=>"test-title"}
519
+ Exposition::Post Load (0.7ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT 1 [["published", "t"], ["slug", "test-title"]]
520
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (25.8ms)
521
+ Completed 200 OK in 577ms (Views: 574.4ms | ActiveRecord: 0.7ms)
522
+
523
+
524
+ Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-03-09 10:42:20 -0500
525
+
526
+
527
+ Started GET "/assets/exposition/application.self-a62a7bf41ef12937bb298c7a80ad574afe343df4bff4a1c70dd4e597618171c0.css?body=1" for ::1 at 2016-03-09 10:42:20 -0500
528
+
529
+
530
+ Started GET "/" for ::1 at 2016-03-09 10:42:21 -0500
531
+ Processing by Exposition::PostsController#index as HTML
532
+  (0.6ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT 10 OFFSET 0) subquery_for_count [["published", "t"]]
533
+ Exposition::Post Load (0.9ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT 10 OFFSET 0 [["published", "t"]]
534
+ Categorical::Tag Exists (0.5ms) SELECT 1 AS one FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 LIMIT 1 [["taggable_id", 2], ["taggable_type", "Exposition::Post"]]
535
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.7ms)
536
+ Categorical::Tag Exists (0.4ms) SELECT 1 AS one FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 LIMIT 1 [["taggable_id", 1], ["taggable_type", "Exposition::Post"]]
537
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.2ms)
538
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml (10.6ms)
539
+  (1.2ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", "t"]]
540
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (23.5ms)
541
+ Completed 200 OK in 52ms (Views: 47.9ms | ActiveRecord: 3.6ms)
542
+
543
+
544
+ Started GET "/" for ::1 at 2016-03-09 10:42:28 -0500
545
+ Processing by Exposition::PostsController#index as HTML
546
+  (0.4ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT 10 OFFSET 0) subquery_for_count [["published", "t"]]
547
+ Exposition::Post Load (0.5ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT 10 OFFSET 0 [["published", "t"]]
548
+ Categorical::Tag Exists (0.5ms) SELECT 1 AS one FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 LIMIT 1 [["taggable_id", 2], ["taggable_type", "Exposition::Post"]]
549
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.5ms)
550
+ Categorical::Tag Exists (0.4ms) SELECT 1 AS one FROM "categorical_tags" INNER JOIN "categorical_taggings" ON "categorical_tags"."id" = "categorical_taggings"."tag_id" WHERE "categorical_taggings"."taggable_id" = $1 AND "categorical_taggings"."taggable_type" = $2 LIMIT 1 [["taggable_id", 1], ["taggable_type", "Exposition::Post"]]
551
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.2ms)
552
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml (10.0ms)
553
+  (0.3ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", "t"]]
554
+ Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (18.8ms)
555
+ Completed 200 OK in 44ms (Views: 40.6ms | ActiveRecord: 2.0ms)