Started GET "/" for ::1 at 2016-03-09 10:34:58 -0500 Processing by Exposition::PostsController#index as HTML  (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"]] 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"]] 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (19.9ms) 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.5ms) Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml (75.2ms)  (0.3ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", "t"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (140.8ms) Completed 200 OK in 2053ms (Views: 1943.1ms | ActiveRecord: 50.1ms) Started GET "/assets/exposition/application.self-0da07a5e42f9d943e9f5c2f290c5a50be8a71195748c98dcf85a2a64ec8854e3.css?body=1" for ::1 at 2016-03-09 10:35:00 -0500 Started GET "/" for ::1 at 2016-03-09 10:35:31 -0500 Processing by Exposition::PostsController#index as HTML  (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"]] 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"]] 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.8ms) 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (2.2ms) Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml (13.1ms)  (0.4ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", "t"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (24.8ms) Completed 200 OK in 52ms (Views: 47.2ms | ActiveRecord: 3.9ms) Started GET "/assets/exposition/application.self-0da07a5e42f9d943e9f5c2f290c5a50be8a71195748c98dcf85a2a64ec8854e3.css?body=1" for ::1 at 2016-03-09 10:35:31 -0500 Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-03-09 10:35:31 -0500 Started GET "/" for ::1 at 2016-03-09 10:35:40 -0500 Processing by Exposition::PostsController#index as HTML  (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"]] 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"]] 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.4ms) 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.3ms) Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml (9.2ms)  (0.4ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", "t"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (19.1ms) Completed 200 OK in 658ms (Views: 654.4ms | ActiveRecord: 2.8ms) Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-03-09 10:35:40 -0500 Started GET "/assets/exposition/application.self-8f19aaf36b36ca6b51a36609715d8d3eb66894ef841f3aaffd831fb6f86cbd59.css?body=1" for ::1 at 2016-03-09 10:35:40 -0500 Started GET "/" for ::1 at 2016-03-09 10:36:12 -0500 Processing by Exposition::PostsController#index as HTML  (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"]] 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"]] 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (5.8ms) 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.8ms) Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml (33.6ms)  (0.6ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", "t"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (83.1ms) Completed 200 OK in 212ms (Views: 174.1ms | ActiveRecord: 5.0ms) Started GET "/admin/login" for ::1 at 2016-03-09 10:36:13 -0500 Processing by Exposition::Admin::SessionsController#new as HTML Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/sessions/new.html.haml within layouts/exposition/admin (35.9ms) Completed 200 OK in 230ms (Views: 229.3ms | ActiveRecord: 0.0ms) Started POST "/admin/login" for ::1 at 2016-03-09 10:36:20 -0500 Processing by Exposition::Admin::SessionsController#create as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"HdPc7HphbJ1ElERBhZYVN5QmruQqafhdlbI7Rt4mQ00gJCLOiIoVzonvYJ+i37D4Ic0TPglSUZx2P2vIINFZHA==", "session"=>{"email"=>"admin@admin.admin", "password"=>"[FILTERED]"}, "commit"=>"Log in"} Exposition::User Load (3.1ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."email" = $1 LIMIT 1 [["email", "admin@admin.admin"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/sessions/new.html.haml within layouts/exposition/admin (1.3ms) Completed 200 OK in 217ms (Views: 37.1ms | ActiveRecord: 6.4ms) Started POST "/admin/login" for ::1 at 2016-03-09 10:36:27 -0500 Processing by Exposition::Admin::SessionsController#create as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"bC5xG33IHurkOflJQz7Mj5m0n3S1G7zlLAqeh5ZOKhZR2Y85jyNnuSlC3Zdkd2lALF8irpYgFSTPh84JaLkwRw==", "session"=>{"email"=>"admin@admin.admin", "password"=>"[FILTERED]"}, "commit"=>"Log in"} Exposition::User Load (0.6ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."email" = $1 LIMIT 1 [["email", "admin@admin.admin"]]  (0.3ms) BEGIN 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]]  (1.6ms) COMMIT Redirected to http://localhost:3000/admin/posts Completed 302 Found in 218ms (ActiveRecord: 11.6ms) Started GET "/admin/posts" for ::1 at 2016-03-09 10:36:28 -0500 Processing by Exposition::Admin::PostsController#index as HTML Exposition::User Load (0.4ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]] Exposition::Post Load (0.9ms) SELECT "exposition_posts".* FROM "exposition_posts" ORDER BY "exposition_posts"."published_at" DESC LIMIT 25 OFFSET 0 CACHE (0.0ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]] 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"]] CACHE (0.0ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]] 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"]]  (0.5ms) SELECT COUNT(*) FROM "exposition_posts" Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/index.html.haml within layouts/exposition/admin (42.2ms) Completed 200 OK in 109ms (Views: 102.8ms | ActiveRecord: 3.3ms) Started GET "/admin/posts/test-title/edit" for ::1 at 2016-03-09 10:36:31 -0500 Processing by Exposition::Admin::PostsController#edit as HTML Parameters: {"id"=>"test-title"} Exposition::User Load (0.5ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]] Exposition::Post Load (0.5ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."slug" = $1 LIMIT 1 [["slug", "test-title"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/shared/_error_handler.html.haml (9.3ms) Exposition::User Load (0.5ms) SELECT "exposition_users".* FROM "exposition_users" Categorical::Tag Load (0.5ms) SELECT "categorical_tags".* FROM "categorical_tags" Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/_form_fields.html.haml (27.2ms) Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/edit.html.haml within layouts/exposition/admin (51.4ms) Completed 200 OK in 108ms (Views: 102.9ms | ActiveRecord: 2.1ms) Started PATCH "/admin/posts/test-title" for ::1 at 2016-03-09 10:37:06 -0500 Processing by Exposition::Admin::PostsController#update as HTML 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"} Exposition::User Load (0.5ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]] Exposition::Post Load (0.6ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."slug" = $1 LIMIT 1 [["slug", "test-title"]]  (0.2ms) BEGIN 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"]] CACHE (0.0ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]] 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 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]]  (0.6ms) COMMIT Redirected to http://localhost:3000/admin/posts Completed 302 Found in 188ms (ActiveRecord: 16.2ms) Started GET "/admin/posts" for ::1 at 2016-03-09 10:37:07 -0500 Processing by Exposition::Admin::PostsController#index as HTML Exposition::User Load (0.6ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]] Exposition::Post Load (0.9ms) SELECT "exposition_posts".* FROM "exposition_posts" ORDER BY "exposition_posts"."published_at" DESC LIMIT 25 OFFSET 0 CACHE (0.0ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]] 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"]] CACHE (0.0ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]] 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"]]  (0.6ms) SELECT COUNT(*) FROM "exposition_posts" Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/index.html.haml within layouts/exposition/admin (27.4ms) Completed 200 OK in 81ms (Views: 75.6ms | ActiveRecord: 3.4ms) Started GET "/" for ::1 at 2016-03-09 10:37:12 -0500 Processing by Exposition::PostsController#index as HTML  (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"]] 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"]] 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.8ms) 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.4ms) Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml (11.7ms)  (0.4ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", "t"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (23.8ms) Completed 200 OK in 59ms (Views: 55.3ms | ActiveRecord: 2.9ms) Started GET "/assets/exposition/application.self-8f19aaf36b36ca6b51a36609715d8d3eb66894ef841f3aaffd831fb6f86cbd59.css?body=1" for ::1 at 2016-03-09 10:37:12 -0500 Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-03-09 10:37:12 -0500 Started GET "/posts/test-title" for ::1 at 2016-03-09 10:37:49 -0500 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"test-title"} 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (30.8ms) Completed 200 OK in 58ms (Views: 55.5ms | ActiveRecord: 0.6ms) Started GET "/posts/test-title" for ::1 at 2016-03-09 10:38:08 -0500 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"test-title"} 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (30.1ms) Completed 200 OK in 61ms (Views: 59.0ms | ActiveRecord: 0.7ms) Started GET "/assets/exposition/application.self-8f19aaf36b36ca6b51a36609715d8d3eb66894ef841f3aaffd831fb6f86cbd59.css?body=1" for ::1 at 2016-03-09 10:38:08 -0500 Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-03-09 10:38:08 -0500 Started GET "/admin/posts/another-test/edit" for ::1 at 2016-03-09 10:38:13 -0500 Processing by Exposition::Admin::PostsController#edit as HTML Parameters: {"id"=>"another-test"} Exposition::User Load (0.6ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]] Exposition::Post Load (0.5ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."slug" = $1 LIMIT 1 [["slug", "another-test"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/shared/_error_handler.html.haml (0.2ms) Exposition::User Load (0.5ms) SELECT "exposition_users".* FROM "exposition_users" Categorical::Tag Load (0.5ms) SELECT "categorical_tags".* FROM "categorical_tags" Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/_form_fields.html.haml (8.2ms) Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/edit.html.haml within layouts/exposition/admin (18.1ms) Completed 200 OK in 77ms (Views: 73.2ms | ActiveRecord: 2.0ms) Started GET "/admin/posts/test-title/edit" for ::1 at 2016-03-09 10:38:16 -0500 Processing by Exposition::Admin::PostsController#edit as HTML Parameters: {"id"=>"test-title"} Exposition::User Load (0.5ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]] Exposition::Post Load (0.6ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."slug" = $1 LIMIT 1 [["slug", "test-title"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/shared/_error_handler.html.haml (0.1ms) Exposition::User Load (0.5ms) SELECT "exposition_users".* FROM "exposition_users" Categorical::Tag Load (0.4ms) SELECT "categorical_tags".* FROM "categorical_tags" Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/_form_fields.html.haml (6.1ms) Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/edit.html.haml within layouts/exposition/admin (14.3ms) Completed 200 OK in 54ms (Views: 50.2ms | ActiveRecord: 2.1ms) Started PATCH "/admin/posts/test-title" for ::1 at 2016-03-09 10:38:27 -0500 Processing by Exposition::Admin::PostsController#update as HTML 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"} Exposition::User Load (0.3ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]] Exposition::Post Load (0.6ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."slug" = $1 LIMIT 1 [["slug", "test-title"]]  (0.2ms) BEGIN 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"]] CACHE (0.0ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]] 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 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]]  (0.5ms) COMMIT Redirected to http://localhost:3000/admin/posts Completed 302 Found in 44ms (ActiveRecord: 5.4ms) Started GET "/admin/posts" for ::1 at 2016-03-09 10:38:27 -0500 Processing by Exposition::Admin::PostsController#index as HTML Exposition::User Load (0.4ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]] Exposition::Post Load (1.2ms) SELECT "exposition_posts".* FROM "exposition_posts" ORDER BY "exposition_posts"."published_at" DESC LIMIT 25 OFFSET 0 CACHE (0.0ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]] 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"]] CACHE (0.0ms) SELECT "exposition_users".* FROM "exposition_users" WHERE "exposition_users"."id" = $1 LIMIT 1 [["id", 1]] 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"]]  (0.5ms) SELECT COUNT(*) FROM "exposition_posts" Rendered /Users/jklina/Development/exposition/app/views/exposition/admin/posts/index.html.haml within layouts/exposition/admin (24.3ms) Completed 200 OK in 62ms (Views: 57.3ms | ActiveRecord: 2.9ms) Started GET "/posts/test-title" for ::1 at 2016-03-09 10:38:33 -0500 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"test-title"} 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (22.6ms) Completed 200 OK in 60ms (Views: 57.2ms | ActiveRecord: 1.1ms) Started GET "/assets/exposition/application.self-8f19aaf36b36ca6b51a36609715d8d3eb66894ef841f3aaffd831fb6f86cbd59.css?body=1" for ::1 at 2016-03-09 10:38:33 -0500 Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-03-09 10:38:33 -0500 Started GET "/posts/test-title" for ::1 at 2016-03-09 10:40:57 -0500 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"test-title"} 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (29.1ms) Completed 500 Internal Server Error in 434ms (ActiveRecord: 0.7ms) ActionView::Template::Error (Undefined mixin 'modular-scale'.): 2: %html 3: %head 4: %title= t('title') 5: = stylesheet_link_tag "exposition/application" 6: = csrf_meta_tags 7: %meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0, maximum-scale=1.0"} 8: %body /Users/jklina/Development/exposition/app/assets/stylesheets/exposition/_layout.scss:18:in `modular-scale' /Users/jklina/Development/exposition/app/assets/stylesheets/exposition/_layout.scss:18 /Users/jklina/Development/exposition/app/assets/stylesheets/exposition/application.scss:10 sass (3.4.21) lib/sass/tree/visitors/perform.rb:349:in `block in visit_mixin' sass (3.4.21) lib/sass/stack.rb:98:in `block in with_mixin' sass (3.4.21) lib/sass/stack.rb:115:in `with_frame' sass (3.4.21) lib/sass/stack.rb:98:in `with_mixin' sass (3.4.21) lib/sass/tree/visitors/perform.rb:347:in `visit_mixin' sass (3.4.21) lib/sass/tree/visitors/base.rb:36:in `visit' sass (3.4.21) lib/sass/tree/visitors/perform.rb:158:in `block in visit' sass (3.4.21) lib/sass/stack.rb:79:in `block in with_base' sass (3.4.21) lib/sass/stack.rb:115:in `with_frame' sass (3.4.21) lib/sass/stack.rb:79:in `with_base' sass (3.4.21) lib/sass/tree/visitors/perform.rb:158:in `visit' sass (3.4.21) lib/sass/tree/visitors/perform.rb:431:in `block (2 levels) in visit_rule' sass (3.4.21) lib/sass/tree/visitors/perform.rb:431:in `map' sass (3.4.21) lib/sass/tree/visitors/perform.rb:431:in `block in visit_rule' sass (3.4.21) lib/sass/tree/visitors/perform.rb:179:in `with_environment' sass (3.4.21) lib/sass/tree/visitors/perform.rb:429:in `visit_rule' sass (3.4.21) lib/sass/tree/visitors/base.rb:36:in `visit' sass (3.4.21) lib/sass/tree/visitors/perform.rb:158:in `block in visit' sass (3.4.21) lib/sass/stack.rb:79:in `block in with_base' sass (3.4.21) lib/sass/stack.rb:115:in `with_frame' sass (3.4.21) lib/sass/stack.rb:79:in `with_base' sass (3.4.21) lib/sass/tree/visitors/perform.rb:158:in `visit' sass (3.4.21) lib/sass/tree/visitors/perform.rb:326:in `block (2 levels) in visit_import' sass (3.4.21) lib/sass/tree/visitors/perform.rb:326:in `map' sass (3.4.21) lib/sass/tree/visitors/perform.rb:326:in `block in visit_import' sass (3.4.21) lib/sass/stack.rb:88:in `block in with_import' sass (3.4.21) lib/sass/stack.rb:115:in `with_frame' sass (3.4.21) lib/sass/stack.rb:88:in `with_import' sass (3.4.21) lib/sass/tree/visitors/perform.rb:323:in `visit_import' sass (3.4.21) lib/sass/tree/visitors/base.rb:36:in `visit' sass (3.4.21) lib/sass/tree/visitors/perform.rb:158:in `block in visit' sass (3.4.21) lib/sass/stack.rb:79:in `block in with_base' sass (3.4.21) lib/sass/stack.rb:115:in `with_frame' sass (3.4.21) lib/sass/stack.rb:79:in `with_base' sass (3.4.21) lib/sass/tree/visitors/perform.rb:158:in `visit' sass (3.4.21) lib/sass/tree/visitors/base.rb:52:in `block in visit_children' sass (3.4.21) lib/sass/tree/visitors/base.rb:52:in `map' sass (3.4.21) lib/sass/tree/visitors/base.rb:52:in `visit_children' sass (3.4.21) lib/sass/tree/visitors/perform.rb:167:in `block in visit_children' sass (3.4.21) lib/sass/tree/visitors/perform.rb:179:in `with_environment' sass (3.4.21) lib/sass/tree/visitors/perform.rb:166:in `visit_children' sass (3.4.21) lib/sass/tree/visitors/base.rb:36:in `block in visit' sass (3.4.21) lib/sass/tree/visitors/perform.rb:186:in `visit_root' sass (3.4.21) lib/sass/tree/visitors/base.rb:36:in `visit' sass (3.4.21) lib/sass/tree/visitors/perform.rb:157:in `visit' sass (3.4.21) lib/sass/tree/visitors/perform.rb:8:in `visit' sass (3.4.21) lib/sass/tree/root_node.rb:36:in `css_tree' sass (3.4.21) lib/sass/tree/root_node.rb:20:in `render' sass (3.4.21) lib/sass/engine.rb:278:in `render' sprockets (3.5.2) lib/sprockets/sass_processor.rb:74:in `block in call' sprockets (3.5.2) lib/sprockets/utils.rb:154:in `module_include' sprockets (3.5.2) lib/sprockets/sass_processor.rb:73:in `call' sprockets (3.5.2) lib/sprockets/sass_processor.rb:30:in `call' sprockets (3.5.2) lib/sprockets/processor_utils.rb:75:in `call_processor' sprockets (3.5.2) lib/sprockets/processor_utils.rb:57:in `block in call_processors' sprockets (3.5.2) lib/sprockets/processor_utils.rb:56:in `reverse_each' sprockets (3.5.2) lib/sprockets/processor_utils.rb:56:in `call_processors' sprockets (3.5.2) lib/sprockets/loader.rb:134:in `load_from_unloaded' sprockets (3.5.2) lib/sprockets/loader.rb:60:in `block in load' sprockets (3.5.2) lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache' sprockets (3.5.2) lib/sprockets/loader.rb:44:in `load' sprockets (3.5.2) lib/sprockets/cached_environment.rb:20:in `block in initialize' sprockets (3.5.2) lib/sprockets/cached_environment.rb:47:in `yield' sprockets (3.5.2) lib/sprockets/cached_environment.rb:47:in `load' sprockets (3.5.2) lib/sprockets/bundle.rb:23:in `block in call' sprockets (3.5.2) lib/sprockets/utils.rb:183:in `dfs' sprockets (3.5.2) lib/sprockets/bundle.rb:24:in `call' sprockets (3.5.2) lib/sprockets/processor_utils.rb:75:in `call_processor' sprockets (3.5.2) lib/sprockets/processor_utils.rb:57:in `block in call_processors' sprockets (3.5.2) lib/sprockets/processor_utils.rb:56:in `reverse_each' sprockets (3.5.2) lib/sprockets/processor_utils.rb:56:in `call_processors' sprockets (3.5.2) lib/sprockets/loader.rb:134:in `load_from_unloaded' sprockets (3.5.2) lib/sprockets/loader.rb:60:in `block in load' sprockets (3.5.2) lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache' sprockets (3.5.2) lib/sprockets/loader.rb:44:in `load' sprockets (3.5.2) lib/sprockets/cached_environment.rb:20:in `block in initialize' sprockets (3.5.2) lib/sprockets/cached_environment.rb:47:in `yield' sprockets (3.5.2) lib/sprockets/cached_environment.rb:47:in `load' sprockets (3.5.2) lib/sprockets/base.rb:66:in `find_asset' sprockets (3.5.2) lib/sprockets/base.rb:92:in `[]' sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:342:in `find_asset' sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:334:in `find_debug_asset' sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:217:in `block in lookup_debug_asset' sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:230:in `block in resolve_asset' sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:229:in `each' sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:229:in `detect' sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:229:in `resolve_asset' sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:216:in `lookup_debug_asset' sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:158:in `block in stylesheet_link_tag' sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:157:in `map' sprockets-rails (3.0.1) lib/sprockets/rails/helper.rb:157:in `stylesheet_link_tag' /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' actionview (4.2.5) lib/action_view/template.rb:145:in `block in render' activesupport (4.2.5) lib/active_support/notifications.rb:166:in `instrument' actionview (4.2.5) lib/action_view/template.rb:333:in `instrument' actionview (4.2.5) lib/action_view/template.rb:143:in `render' actionview (4.2.5) lib/action_view/renderer/template_renderer.rb:66:in `render_with_layout' actionview (4.2.5) lib/action_view/renderer/template_renderer.rb:52:in `render_template' actionview (4.2.5) lib/action_view/renderer/template_renderer.rb:14:in `render' actionview (4.2.5) lib/action_view/renderer/renderer.rb:42:in `render_template' actionview (4.2.5) lib/action_view/renderer/renderer.rb:23:in `render' actionview (4.2.5) lib/action_view/rendering.rb:100:in `_render_template' actionpack (4.2.5) lib/action_controller/metal/streaming.rb:217:in `_render_template' actionview (4.2.5) lib/action_view/rendering.rb:83:in `render_to_body' actionpack (4.2.5) lib/action_controller/metal/rendering.rb:32:in `render_to_body' actionpack (4.2.5) lib/action_controller/metal/renderers.rb:37:in `render_to_body' actionpack (4.2.5) lib/abstract_controller/rendering.rb:25:in `render' actionpack (4.2.5) lib/action_controller/metal/rendering.rb:16:in `render' actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render' activesupport (4.2.5) lib/active_support/core_ext/benchmark.rb:12:in `block in ms' /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/2.2.0/benchmark.rb:303:in `realtime' activesupport (4.2.5) lib/active_support/core_ext/benchmark.rb:12:in `ms' actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:44:in `block in render' actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime' activerecord (4.2.5) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime' actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:43:in `render' actionpack (4.2.5) lib/action_controller/metal/implicit_render.rb:10:in `default_render' actionpack (4.2.5) lib/action_controller/metal/implicit_render.rb:5:in `send_action' actionpack (4.2.5) lib/abstract_controller/base.rb:198:in `process_action' actionpack (4.2.5) lib/action_controller/metal/rendering.rb:10:in `process_action' actionpack (4.2.5) lib/abstract_controller/callbacks.rb:20:in `block in process_action' activesupport (4.2.5) lib/active_support/callbacks.rb:117:in `call' activesupport (4.2.5) lib/active_support/callbacks.rb:117:in `call' activesupport (4.2.5) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile' activesupport (4.2.5) lib/active_support/callbacks.rb:505:in `call' activesupport (4.2.5) lib/active_support/callbacks.rb:505:in `call' activesupport (4.2.5) lib/active_support/callbacks.rb:92:in `__run_callbacks__' activesupport (4.2.5) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks' activesupport (4.2.5) lib/active_support/callbacks.rb:81:in `run_callbacks' actionpack (4.2.5) lib/abstract_controller/callbacks.rb:19:in `process_action' actionpack (4.2.5) lib/action_controller/metal/rescue.rb:29:in `process_action' actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' activesupport (4.2.5) lib/active_support/notifications.rb:164:in `block in instrument' activesupport (4.2.5) lib/active_support/notifications/instrumenter.rb:20:in `instrument' activesupport (4.2.5) lib/active_support/notifications.rb:164:in `instrument' actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:30:in `process_action' actionpack (4.2.5) lib/action_controller/metal/params_wrapper.rb:250:in `process_action' activerecord (4.2.5) lib/active_record/railties/controller_runtime.rb:18:in `process_action' actionpack (4.2.5) lib/abstract_controller/base.rb:137:in `process' actionview (4.2.5) lib/action_view/rendering.rb:30:in `process' actionpack (4.2.5) lib/action_controller/metal.rb:196:in `dispatch' actionpack (4.2.5) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch' actionpack (4.2.5) lib/action_controller/metal.rb:237:in `block in action' actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:76:in `call' actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:76:in `dispatch' actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:45:in `serve' actionpack (4.2.5) lib/action_dispatch/journey/router.rb:43:in `block in serve' actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `each' actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `serve' actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:817:in `call' railties (4.2.5) lib/rails/engine.rb:518:in `call' railties (4.2.5) lib/rails/railtie.rb:194:in `public_send' railties (4.2.5) lib/rails/railtie.rb:194:in `method_missing' actionpack (4.2.5) lib/action_dispatch/routing/mapper.rb:51:in `serve' actionpack (4.2.5) lib/action_dispatch/journey/router.rb:43:in `block in serve' actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `each' actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `serve' actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:817:in `call' rack (1.6.4) lib/rack/etag.rb:24:in `call' rack (1.6.4) lib/rack/conditionalget.rb:25:in `call' rack (1.6.4) lib/rack/head.rb:13:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/params_parser.rb:27:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/flash.rb:260:in `call' rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context' rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/cookies.rb:560:in `call' activerecord (4.2.5) lib/active_record/query_cache.rb:36:in `call' activerecord (4.2.5) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call' activerecord (4.2.5) lib/active_record/migration.rb:377:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' activesupport (4.2.5) lib/active_support/callbacks.rb:88:in `__run_callbacks__' activesupport (4.2.5) lib/active_support/callbacks.rb:778:in `_run_call_callbacks' activesupport (4.2.5) lib/active_support/callbacks.rb:81:in `run_callbacks' actionpack (4.2.5) lib/action_dispatch/middleware/callbacks.rb:27:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/reloader.rb:73:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/remote_ip.rb:78:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' railties (4.2.5) lib/rails/rack/logger.rb:38:in `call_app' railties (4.2.5) lib/rails/rack/logger.rb:20:in `block in call' activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `block in tagged' activesupport (4.2.5) lib/active_support/tagged_logging.rb:26:in `tagged' activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `tagged' railties (4.2.5) lib/rails/rack/logger.rb:20:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/request_id.rb:21:in `call' rack (1.6.4) lib/rack/methodoverride.rb:22:in `call' rack (1.6.4) lib/rack/runtime.rb:18:in `call' activesupport (4.2.5) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' rack (1.6.4) lib/rack/lock.rb:17:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/static.rb:116:in `call' rack (1.6.4) lib/rack/sendfile.rb:113:in `call' railties (4.2.5) lib/rails/engine.rb:518:in `call' railties (4.2.5) lib/rails/application.rb:165:in `call' rack (1.6.4) lib/rack/lock.rb:17:in `call' rack (1.6.4) lib/rack/content_length.rb:15:in `call' rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service' /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service' /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run' /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread' 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) 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) 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) 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) Started GET "/posts/test-title" for ::1 at 2016-03-09 10:41:29 -0500 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"test-title"} 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (32.3ms) Completed 200 OK in 780ms (Views: 776.1ms | ActiveRecord: 1.3ms) Started GET "/assets/exposition/application.self-a4451bd9952cffa298bc437ef0d7a70a0bd179bae6b179961a6f6dc0b15b7557.css?body=1" for ::1 at 2016-03-09 10:41:30 -0500 Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-03-09 10:41:30 -0500 Started GET "/posts/test-title" for ::1 at 2016-03-09 10:41:42 -0500 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"test-title"} 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (26.2ms) Completed 200 OK in 588ms (Views: 585.6ms | ActiveRecord: 0.8ms) Started GET "/assets/exposition/application.self-5b55adb8abd1219962976af272a6e05f79a94f51d0cb8405d4cc74dd4556565e.css?body=1" for ::1 at 2016-03-09 10:41:43 -0500 Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-03-09 10:41:43 -0500 Started GET "/posts/test-title" for ::1 at 2016-03-09 10:42:19 -0500 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"test-title"} 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (25.8ms) Completed 200 OK in 577ms (Views: 574.4ms | ActiveRecord: 0.7ms) Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-03-09 10:42:20 -0500 Started GET "/assets/exposition/application.self-a62a7bf41ef12937bb298c7a80ad574afe343df4bff4a1c70dd4e597618171c0.css?body=1" for ::1 at 2016-03-09 10:42:20 -0500 Started GET "/" for ::1 at 2016-03-09 10:42:21 -0500 Processing by Exposition::PostsController#index as HTML  (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"]] 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"]] 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.7ms) 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.2ms) Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml (10.6ms)  (1.2ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", "t"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (23.5ms) Completed 200 OK in 52ms (Views: 47.9ms | ActiveRecord: 3.6ms) Started GET "/" for ::1 at 2016-03-09 10:42:28 -0500 Processing by Exposition::PostsController#index as HTML  (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"]] 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"]] 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.5ms) 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"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.2ms) Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml (10.0ms)  (0.3ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", "t"]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (18.8ms) Completed 200 OK in 44ms (Views: 40.6ms | ActiveRecord: 2.0ms) Started GET "/" for ::1 at 2016-06-10 13:16:28 -0400 Processing by Exposition::PostsController#index as HTML Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application  (4.7ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT $2 OFFSET $3) subquery_for_count [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Exposition::Post Load (3.2ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT $2 OFFSET $3 [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Categorical::Tag Exists (6.3ms) 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 $3 [["taggable_id", 2], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (61.7ms) 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 $3 [["taggable_id", 1], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (2.0ms) Rendered collection of /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml [2 times] (133.0ms)  (0.6ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", true]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (218.9ms) Completed 200 OK in 2282ms (Views: 2151.1ms | ActiveRecord: 69.8ms) Started GET "/assets/exposition/application.self-a62a7bf41ef12937bb298c7a80ad574afe343df4bff4a1c70dd4e597618171c0.css?body=1" for ::1 at 2016-06-10 13:16:31 -0400 Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-06-10 13:16:31 -0400 Started GET "/" for ::1 at 2016-06-10 13:20:17 -0400 Processing by Exposition::PostsController#index as HTML Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application  (0.9ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT $2 OFFSET $3) subquery_for_count [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Exposition::Post Load (2.6ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT $2 OFFSET $3 [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Categorical::Tag Exists (1.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 $3 [["taggable_id", 2], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (7.3ms) Categorical::Tag Exists (1.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 $3 [["taggable_id", 1], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (2.3ms) Rendered collection of /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml [2 times] (33.2ms)  (0.6ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", true]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (78.1ms) Completed 500 Internal Server Error in 187ms (ActiveRecord: 6.7ms) ActionView::Template::Error (undefined local variable or method `page_description' for #<#:0x007f9c0b4dc1b0>): 5: %meta{"http-equiv" => "x-ua-compatible", content: "ie=edge"} 6: %meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0, maximum-scale=1.0"} 7: %meta{charset: "utf-8"} 8: %meta{name: "description", content: page_description} 9: %base{href: request.base_url} 10: = stylesheet_link_tag "exposition/application" 11: = csrf_meta_tags /Users/jklina/Development/exposition/app/views/layouts/exposition/application.html.haml:8:in `___sers_jklina__evelopment_exposition_app_views_layouts_exposition_application_html_haml___1285866276602022106_70154112931880' actionview (5.0.0.rc1) lib/action_view/template.rb:158:in `block in render' activesupport (5.0.0.rc1) lib/active_support/notifications.rb:166:in `instrument' actionview (5.0.0.rc1) lib/action_view/template.rb:348:in `instrument' actionview (5.0.0.rc1) lib/action_view/template.rb:156:in `render' actionview (5.0.0.rc1) lib/action_view/renderer/template_renderer.rb:66:in `render_with_layout' actionview (5.0.0.rc1) lib/action_view/renderer/template_renderer.rb:52:in `render_template' actionview (5.0.0.rc1) lib/action_view/renderer/template_renderer.rb:14:in `render' actionview (5.0.0.rc1) lib/action_view/renderer/renderer.rb:42:in `render_template' actionview (5.0.0.rc1) lib/action_view/renderer/renderer.rb:23:in `render' actionview (5.0.0.rc1) lib/action_view/rendering.rb:103:in `_render_template' actionpack (5.0.0.rc1) lib/action_controller/metal/streaming.rb:217:in `_render_template' actionview (5.0.0.rc1) lib/action_view/rendering.rb:83:in `render_to_body' actionpack (5.0.0.rc1) lib/action_controller/metal/rendering.rb:52:in `render_to_body' actionpack (5.0.0.rc1) lib/action_controller/metal/renderers.rb:144:in `render_to_body' actionpack (5.0.0.rc1) lib/abstract_controller/rendering.rb:26:in `render' actionpack (5.0.0.rc1) lib/action_controller/metal/rendering.rb:36:in `render' actionpack (5.0.0.rc1) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render' activesupport (5.0.0.rc1) lib/active_support/core_ext/benchmark.rb:12:in `block in ms' /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/2.2.0/benchmark.rb:303:in `realtime' activesupport (5.0.0.rc1) lib/active_support/core_ext/benchmark.rb:12:in `ms' actionpack (5.0.0.rc1) lib/action_controller/metal/instrumentation.rb:44:in `block in render' actionpack (5.0.0.rc1) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime' activerecord (5.0.0.rc1) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime' actionpack (5.0.0.rc1) lib/action_controller/metal/instrumentation.rb:43:in `render' actionpack (5.0.0.rc1) lib/action_controller/metal/implicit_render.rb:36:in `default_render' actionpack (5.0.0.rc1) lib/action_controller/metal/basic_implicit_render.rb:4:in `block in send_action' actionpack (5.0.0.rc1) lib/action_controller/metal/basic_implicit_render.rb:4:in `tap' actionpack (5.0.0.rc1) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action' actionpack (5.0.0.rc1) lib/abstract_controller/base.rb:181:in `process_action' actionpack (5.0.0.rc1) lib/action_controller/metal/rendering.rb:30:in `process_action' actionpack (5.0.0.rc1) lib/abstract_controller/callbacks.rb:20:in `block in process_action' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:126:in `call' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:126:in `call' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:506:in `block (2 levels) in compile' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:455:in `call' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:455:in `call' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:101:in `__run_callbacks__' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:90:in `run_callbacks' actionpack (5.0.0.rc1) lib/abstract_controller/callbacks.rb:19:in `process_action' actionpack (5.0.0.rc1) lib/action_controller/metal/rescue.rb:31:in `process_action' actionpack (5.0.0.rc1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' activesupport (5.0.0.rc1) lib/active_support/notifications.rb:164:in `block in instrument' activesupport (5.0.0.rc1) lib/active_support/notifications/instrumenter.rb:21:in `instrument' activesupport (5.0.0.rc1) lib/active_support/notifications.rb:164:in `instrument' actionpack (5.0.0.rc1) lib/action_controller/metal/instrumentation.rb:30:in `process_action' actionpack (5.0.0.rc1) lib/action_controller/metal/params_wrapper.rb:248:in `process_action' activerecord (5.0.0.rc1) lib/active_record/railties/controller_runtime.rb:18:in `process_action' actionpack (5.0.0.rc1) lib/abstract_controller/base.rb:126:in `process' actionview (5.0.0.rc1) lib/action_view/rendering.rb:30:in `process' actionpack (5.0.0.rc1) lib/action_controller/metal.rb:190:in `dispatch' actionpack (5.0.0.rc1) lib/action_controller/metal.rb:262:in `dispatch' actionpack (5.0.0.rc1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch' actionpack (5.0.0.rc1) lib/action_dispatch/routing/route_set.rb:32:in `serve' actionpack (5.0.0.rc1) lib/action_dispatch/journey/router.rb:39:in `block in serve' actionpack (5.0.0.rc1) lib/action_dispatch/journey/router.rb:26:in `each' actionpack (5.0.0.rc1) lib/action_dispatch/journey/router.rb:26:in `serve' actionpack (5.0.0.rc1) lib/action_dispatch/routing/route_set.rb:725:in `call' railties (5.0.0.rc1) lib/rails/engine.rb:522:in `call' railties (5.0.0.rc1) lib/rails/railtie.rb:193:in `public_send' railties (5.0.0.rc1) lib/rails/railtie.rb:193:in `method_missing' actionpack (5.0.0.rc1) lib/action_dispatch/routing/mapper.rb:17:in `block in ' actionpack (5.0.0.rc1) lib/action_dispatch/routing/mapper.rb:46:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/routing/mapper.rb:46:in `serve' actionpack (5.0.0.rc1) lib/action_dispatch/journey/router.rb:39:in `block in serve' actionpack (5.0.0.rc1) lib/action_dispatch/journey/router.rb:26:in `each' actionpack (5.0.0.rc1) lib/action_dispatch/journey/router.rb:26:in `serve' actionpack (5.0.0.rc1) lib/action_dispatch/routing/route_set.rb:725:in `call' actionview (5.0.0.rc1) lib/action_view/digestor.rb:12:in `call' rack (2.0.0.rc1) lib/rack/etag.rb:25:in `call' rack (2.0.0.rc1) lib/rack/conditional_get.rb:25:in `call' rack (2.0.0.rc1) lib/rack/head.rb:12:in `call' rack (2.0.0.rc1) lib/rack/session/abstract/id.rb:222:in `context' rack (2.0.0.rc1) lib/rack/session/abstract/id.rb:216:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/cookies.rb:613:in `call' activerecord (5.0.0.rc1) lib/active_record/migration.rb:552:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:97:in `__run_callbacks__' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:90:in `run_callbacks' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/callbacks.rb:36:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/executor.rb:12:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call' railties (5.0.0.rc1) lib/rails/rack/logger.rb:36:in `call_app' railties (5.0.0.rc1) lib/rails/rack/logger.rb:24:in `block in call' activesupport (5.0.0.rc1) lib/active_support/tagged_logging.rb:70:in `block in tagged' activesupport (5.0.0.rc1) lib/active_support/tagged_logging.rb:26:in `tagged' activesupport (5.0.0.rc1) lib/active_support/tagged_logging.rb:70:in `tagged' railties (5.0.0.rc1) lib/rails/rack/logger.rb:24:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/request_id.rb:24:in `call' rack (2.0.0.rc1) lib/rack/method_override.rb:22:in `call' rack (2.0.0.rc1) lib/rack/runtime.rb:22:in `call' activesupport (5.0.0.rc1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/executor.rb:12:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/static.rb:136:in `call' rack (2.0.0.rc1) lib/rack/sendfile.rb:111:in `call' railties (5.0.0.rc1) lib/rails/engine.rb:522:in `call' rack (2.0.0.rc1) lib/rack/handler/webrick.rb:86:in `service' /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service' /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run' /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread' Rendering /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.rc1/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout Rendering /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.rc1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb Rendered /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.rc1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (7.3ms) Rendering /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.rc1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb Rendered /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.rc1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (3.3ms) Rendering /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.rc1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb Rendered /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.rc1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (3.2ms) Rendered /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.rc1/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (92.9ms) Started GET "/" for ::1 at 2016-06-10 13:47:07 -0400 Processing by Exposition::PostsController#index as HTML Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application  (1.4ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT $2 OFFSET $3) subquery_for_count [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Exposition::Post Load (2.2ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT $2 OFFSET $3 [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Categorical::Tag Exists (1.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 $3 [["taggable_id", 2], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (6.8ms) 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 $3 [["taggable_id", 1], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.9ms) Rendered collection of /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml [2 times] (44.4ms)  (0.6ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", true]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (85.7ms) Completed 200 OK in 179ms (Views: 142.9ms | ActiveRecord: 6.4ms) Started GET "/" for ::1 at 2016-06-10 13:47:37 -0400 Processing by Exposition::PostsController#index as HTML Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application  (0.7ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT $2 OFFSET $3) subquery_for_count [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Exposition::Post Load (0.8ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT $2 OFFSET $3 [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Categorical::Tag Exists (1.2ms) 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 $3 [["taggable_id", 2], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (7.0ms) Categorical::Tag Exists (1.2ms) 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 $3 [["taggable_id", 1], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (2.4ms) Rendered collection of /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml [2 times] (27.8ms)  (0.5ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", true]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (51.3ms) Completed 200 OK in 156ms (Views: 142.3ms | ActiveRecord: 4.4ms) Started GET "/" for ::1 at 2016-06-10 13:47:42 -0400 Processing by Exposition::PostsController#index as HTML Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application  (5.3ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT $2 OFFSET $3) subquery_for_count [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Exposition::Post Load (3.6ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT $2 OFFSET $3 [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Categorical::Tag Exists (3.2ms) 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 $3 [["taggable_id", 2], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (7.7ms) 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 $3 [["taggable_id", 1], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (2.2ms) Rendered collection of /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml [2 times] (21.1ms)  (0.8ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", true]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (54.3ms) Completed 200 OK in 97ms (Views: 78.6ms | ActiveRecord: 13.7ms) Started GET "/" for ::1 at 2016-06-10 13:47:47 -0400 Processing by Exposition::PostsController#index as HTML Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application  (0.6ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT $2 OFFSET $3) subquery_for_count [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Exposition::Post Load (0.8ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT $2 OFFSET $3 [["published", true], ["LIMIT", 10], ["OFFSET", 0]] 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 $3 [["taggable_id", 2], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (4.7ms) 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 $3 [["taggable_id", 1], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (2.8ms) Rendered collection of /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml [2 times] (25.0ms)  (0.6ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", true]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (43.7ms) Completed 200 OK in 101ms (Views: 92.6ms | ActiveRecord: 3.7ms) Started GET "/" for ::1 at 2016-06-10 13:47:48 -0400 Processing by Exposition::PostsController#index as HTML Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application  (0.7ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT $2 OFFSET $3) subquery_for_count [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Exposition::Post Load (0.8ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT $2 OFFSET $3 [["published", true], ["LIMIT", 10], ["OFFSET", 0]] 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 $3 [["taggable_id", 2], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (6.0ms) Categorical::Tag Exists (1.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 $3 [["taggable_id", 1], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (3.8ms) Rendered collection of /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml [2 times] (25.4ms)  (0.5ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", true]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (43.8ms) Completed 200 OK in 104ms (Views: 96.4ms | ActiveRecord: 3.8ms) Started GET "/" for ::1 at 2016-06-10 13:48:34 -0400 Processing by Exposition::PostsController#index as HTML Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application  (0.7ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT $2 OFFSET $3) subquery_for_count [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Exposition::Post Load (1.0ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT $2 OFFSET $3 [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Categorical::Tag Exists (1.1ms) 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 $3 [["taggable_id", 2], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (9.3ms) 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 $3 [["taggable_id", 1], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (1.9ms) Rendered collection of /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml [2 times] (36.5ms)  (0.5ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", true]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (73.4ms) Completed 200 OK in 153ms (Views: 97.4ms | ActiveRecord: 41.6ms) Started GET "/posts/another-test" for ::1 at 2016-06-11 14:02:22 -0400 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"another-test"} Exposition::Post Load (3.7ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT $3 [["published", true], ["slug", "another-test"], ["LIMIT", 1]] Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (7.3ms) Completed 200 OK in 212ms (Views: 134.3ms | ActiveRecord: 3.7ms) Started GET "/posts/another-test" for ::1 at 2016-06-11 14:03:48 -0400 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"another-test"} Exposition::Post Load (1.5ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT $3 [["published", true], ["slug", "another-test"], ["LIMIT", 1]] Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (22.2ms) Completed 500 Internal Server Error in 38ms (ActiveRecord: 1.5ms) ActionView::Template::Error (undefined method `page_description' for #<#:0x007f9c1215aaf8>): 1: - title(@post.title) 2: - page_description(@post.summary) 3: %article.post 4: %section.content 5: %h2= @post.title /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml:2:in `___sers_jklina__evelopment_exposition_app_views_exposition_posts_show_html_haml__4567656514483079070_70154147519080' actionview (5.0.0.rc1) lib/action_view/template.rb:158:in `block in render' activesupport (5.0.0.rc1) lib/active_support/notifications.rb:166:in `instrument' actionview (5.0.0.rc1) lib/action_view/template.rb:348:in `instrument' actionview (5.0.0.rc1) lib/action_view/template.rb:156:in `render' actionview (5.0.0.rc1) lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template' actionview (5.0.0.rc1) lib/action_view/renderer/abstract_renderer.rb:42:in `block in instrument' activesupport (5.0.0.rc1) lib/active_support/notifications.rb:164:in `block in instrument' activesupport (5.0.0.rc1) lib/active_support/notifications/instrumenter.rb:21:in `instrument' activesupport (5.0.0.rc1) lib/active_support/notifications.rb:164:in `instrument' actionview (5.0.0.rc1) lib/action_view/renderer/abstract_renderer.rb:41:in `instrument' actionview (5.0.0.rc1) lib/action_view/renderer/template_renderer.rb:53:in `block in render_template' actionview (5.0.0.rc1) lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout' actionview (5.0.0.rc1) lib/action_view/renderer/template_renderer.rb:52:in `render_template' actionview (5.0.0.rc1) lib/action_view/renderer/template_renderer.rb:14:in `render' actionview (5.0.0.rc1) lib/action_view/renderer/renderer.rb:42:in `render_template' actionview (5.0.0.rc1) lib/action_view/renderer/renderer.rb:23:in `render' actionview (5.0.0.rc1) lib/action_view/rendering.rb:103:in `_render_template' actionpack (5.0.0.rc1) lib/action_controller/metal/streaming.rb:217:in `_render_template' actionview (5.0.0.rc1) lib/action_view/rendering.rb:83:in `render_to_body' actionpack (5.0.0.rc1) lib/action_controller/metal/rendering.rb:52:in `render_to_body' actionpack (5.0.0.rc1) lib/action_controller/metal/renderers.rb:144:in `render_to_body' actionpack (5.0.0.rc1) lib/abstract_controller/rendering.rb:26:in `render' actionpack (5.0.0.rc1) lib/action_controller/metal/rendering.rb:36:in `render' actionpack (5.0.0.rc1) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render' activesupport (5.0.0.rc1) lib/active_support/core_ext/benchmark.rb:12:in `block in ms' /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/2.2.0/benchmark.rb:303:in `realtime' activesupport (5.0.0.rc1) lib/active_support/core_ext/benchmark.rb:12:in `ms' actionpack (5.0.0.rc1) lib/action_controller/metal/instrumentation.rb:44:in `block in render' actionpack (5.0.0.rc1) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime' activerecord (5.0.0.rc1) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime' actionpack (5.0.0.rc1) lib/action_controller/metal/instrumentation.rb:43:in `render' actionpack (5.0.0.rc1) lib/action_controller/metal/implicit_render.rb:36:in `default_render' actionpack (5.0.0.rc1) lib/action_controller/metal/basic_implicit_render.rb:4:in `block in send_action' actionpack (5.0.0.rc1) lib/action_controller/metal/basic_implicit_render.rb:4:in `tap' actionpack (5.0.0.rc1) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action' actionpack (5.0.0.rc1) lib/abstract_controller/base.rb:181:in `process_action' actionpack (5.0.0.rc1) lib/action_controller/metal/rendering.rb:30:in `process_action' actionpack (5.0.0.rc1) lib/abstract_controller/callbacks.rb:20:in `block in process_action' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:126:in `call' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:126:in `call' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:506:in `block (2 levels) in compile' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:455:in `call' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:455:in `call' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:101:in `__run_callbacks__' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:90:in `run_callbacks' actionpack (5.0.0.rc1) lib/abstract_controller/callbacks.rb:19:in `process_action' actionpack (5.0.0.rc1) lib/action_controller/metal/rescue.rb:31:in `process_action' actionpack (5.0.0.rc1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' activesupport (5.0.0.rc1) lib/active_support/notifications.rb:164:in `block in instrument' activesupport (5.0.0.rc1) lib/active_support/notifications/instrumenter.rb:21:in `instrument' activesupport (5.0.0.rc1) lib/active_support/notifications.rb:164:in `instrument' actionpack (5.0.0.rc1) lib/action_controller/metal/instrumentation.rb:30:in `process_action' actionpack (5.0.0.rc1) lib/action_controller/metal/params_wrapper.rb:248:in `process_action' activerecord (5.0.0.rc1) lib/active_record/railties/controller_runtime.rb:18:in `process_action' actionpack (5.0.0.rc1) lib/abstract_controller/base.rb:126:in `process' actionview (5.0.0.rc1) lib/action_view/rendering.rb:30:in `process' actionpack (5.0.0.rc1) lib/action_controller/metal.rb:190:in `dispatch' actionpack (5.0.0.rc1) lib/action_controller/metal.rb:262:in `dispatch' actionpack (5.0.0.rc1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch' actionpack (5.0.0.rc1) lib/action_dispatch/routing/route_set.rb:32:in `serve' actionpack (5.0.0.rc1) lib/action_dispatch/journey/router.rb:39:in `block in serve' actionpack (5.0.0.rc1) lib/action_dispatch/journey/router.rb:26:in `each' actionpack (5.0.0.rc1) lib/action_dispatch/journey/router.rb:26:in `serve' actionpack (5.0.0.rc1) lib/action_dispatch/routing/route_set.rb:725:in `call' railties (5.0.0.rc1) lib/rails/engine.rb:522:in `call' railties (5.0.0.rc1) lib/rails/railtie.rb:193:in `public_send' railties (5.0.0.rc1) lib/rails/railtie.rb:193:in `method_missing' actionpack (5.0.0.rc1) lib/action_dispatch/routing/mapper.rb:17:in `block in ' actionpack (5.0.0.rc1) lib/action_dispatch/routing/mapper.rb:46:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/routing/mapper.rb:46:in `serve' actionpack (5.0.0.rc1) lib/action_dispatch/journey/router.rb:39:in `block in serve' actionpack (5.0.0.rc1) lib/action_dispatch/journey/router.rb:26:in `each' actionpack (5.0.0.rc1) lib/action_dispatch/journey/router.rb:26:in `serve' actionpack (5.0.0.rc1) lib/action_dispatch/routing/route_set.rb:725:in `call' actionview (5.0.0.rc1) lib/action_view/digestor.rb:12:in `call' rack (2.0.0.rc1) lib/rack/etag.rb:25:in `call' rack (2.0.0.rc1) lib/rack/conditional_get.rb:25:in `call' rack (2.0.0.rc1) lib/rack/head.rb:12:in `call' rack (2.0.0.rc1) lib/rack/session/abstract/id.rb:222:in `context' rack (2.0.0.rc1) lib/rack/session/abstract/id.rb:216:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/cookies.rb:613:in `call' activerecord (5.0.0.rc1) lib/active_record/migration.rb:552:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:97:in `__run_callbacks__' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks' activesupport (5.0.0.rc1) lib/active_support/callbacks.rb:90:in `run_callbacks' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/callbacks.rb:36:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/executor.rb:12:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call' railties (5.0.0.rc1) lib/rails/rack/logger.rb:36:in `call_app' railties (5.0.0.rc1) lib/rails/rack/logger.rb:24:in `block in call' activesupport (5.0.0.rc1) lib/active_support/tagged_logging.rb:70:in `block in tagged' activesupport (5.0.0.rc1) lib/active_support/tagged_logging.rb:26:in `tagged' activesupport (5.0.0.rc1) lib/active_support/tagged_logging.rb:70:in `tagged' railties (5.0.0.rc1) lib/rails/rack/logger.rb:24:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/request_id.rb:24:in `call' rack (2.0.0.rc1) lib/rack/method_override.rb:22:in `call' rack (2.0.0.rc1) lib/rack/runtime.rb:22:in `call' activesupport (5.0.0.rc1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/executor.rb:12:in `call' actionpack (5.0.0.rc1) lib/action_dispatch/middleware/static.rb:136:in `call' rack (2.0.0.rc1) lib/rack/sendfile.rb:111:in `call' railties (5.0.0.rc1) lib/rails/engine.rb:522:in `call' rack (2.0.0.rc1) lib/rack/handler/webrick.rb:86:in `service' /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service' /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run' /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread' Rendering /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.rc1/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout Rendering /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.rc1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb Rendered /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.rc1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (8.6ms) Rendering /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.rc1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb Rendered /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.rc1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (4.1ms) Rendering /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.rc1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb Rendered /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.rc1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (2.0ms) Rendered /Users/jklina/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.rc1/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (88.7ms) Started GET "/posts/another-test" for ::1 at 2016-06-11 14:08:14 -0400 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"another-test"} Exposition::Post Load (1.2ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT $3 [["published", true], ["slug", "another-test"], ["LIMIT", 1]] Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (5.7ms) Completed 200 OK in 152ms (Views: 71.7ms | ActiveRecord: 20.2ms) Started GET "/posts/another-test" for ::1 at 2016-06-11 14:08:22 -0400 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"another-test"} Exposition::Post Load (1.8ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT $3 [["published", true], ["slug", "another-test"], ["LIMIT", 1]] Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (2.8ms) Completed 200 OK in 47ms (Views: 39.0ms | ActiveRecord: 1.8ms) Started GET "/posts/another-test" for ::1 at 2016-06-11 14:08:49 -0400 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"another-test"} Exposition::Post Load (2.6ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT $3 [["published", true], ["slug", "another-test"], ["LIMIT", 1]] Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (2.6ms) Completed 200 OK in 54ms (Views: 45.3ms | ActiveRecord: 2.6ms) Started GET "/posts/another-test" for ::1 at 2016-06-11 14:08:54 -0400 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"another-test"} Exposition::Post Load (1.1ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT $3 [["published", true], ["slug", "another-test"], ["LIMIT", 1]] Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (3.4ms) Completed 200 OK in 41ms (Views: 34.7ms | ActiveRecord: 1.1ms) Started GET "/posts/another-test" for ::1 at 2016-06-11 14:10:17 -0400 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"another-test"} Exposition::Post Load (1.4ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT $3 [["published", true], ["slug", "another-test"], ["LIMIT", 1]] Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (3.1ms) Completed 200 OK in 81ms (Views: 46.0ms | ActiveRecord: 9.2ms) Started GET "/posts/another-test" for ::1 at 2016-06-11 17:05:15 -0400 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"another-test"} Exposition::Post Load (6.1ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT $3 [["published", true], ["slug", "another-test"], ["LIMIT", 1]] Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (27.0ms) Completed 200 OK in 235ms (Views: 186.8ms | ActiveRecord: 6.1ms) Started GET "/posts/another-test" for ::1 at 2016-06-11 17:05:18 -0400 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"another-test"} Exposition::Post Load (1.7ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT $3 [["published", true], ["slug", "another-test"], ["LIMIT", 1]] Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (3.0ms) Completed 200 OK in 83ms (Views: 74.0ms | ActiveRecord: 1.7ms) Started GET "/" for ::1 at 2016-06-11 17:24:06 -0400 Processing by Exposition::PostsController#index as HTML Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application  (7.5ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT $2 OFFSET $3) subquery_for_count [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Exposition::Post Load (5.3ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT $2 OFFSET $3 [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Categorical::Tag Exists (2.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 $3 [["taggable_id", 2], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (44.5ms) Categorical::Tag Exists (1.1ms) 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 $3 [["taggable_id", 1], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (2.4ms) Rendered collection of /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml [2 times] (161.8ms)  (0.5ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", true]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (240.6ms) Completed 200 OK in 437ms (Views: 352.7ms | ActiveRecord: 63.2ms) Started GET "/posts/test-title" for ::1 at 2016-06-11 17:24:08 -0400 Processing by Exposition::PostsController#show as HTML Parameters: {"id"=>"test-title"} Exposition::Post Load (3.0ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 AND "exposition_posts"."slug" = $2 LIMIT $3 [["published", true], ["slug", "test-title"], ["LIMIT", 1]] Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/show.html.haml within layouts/exposition/application (103.6ms) Completed 200 OK in 210ms (Views: 200.1ms | ActiveRecord: 3.0ms) Started GET "/" for ::1 at 2016-06-24 18:58:58 -0400 Processing by Exposition::PostsController#index as HTML Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application  (2.1ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT $2 OFFSET $3) subquery_for_count [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Exposition::Post Load (1.6ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT $2 OFFSET $3 [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Categorical::Tag Exists (2.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 $3 [["taggable_id", 2], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (22.7ms) 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 $3 [["taggable_id", 1], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (2.4ms) Rendered collection of /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml [2 times] (105.7ms)  (0.7ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", true]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (167.4ms) Completed 200 OK in 691ms (Views: 558.2ms | ActiveRecord: 42.4ms) Started GET "/assets/exposition/application.self-a62a7bf41ef12937bb298c7a80ad574afe343df4bff4a1c70dd4e597618171c0.css?body=1" for ::1 at 2016-06-24 18:58:59 -0400 Started GET "/assets/exposition/twitter-5ed7dd10b95665b5d9056ecdab697788dd8b2ce71cecb98972b70b7b27a93213.svg" for ::1 at 2016-06-24 18:58:59 -0400 Started GET "/" for ::1 at 2016-06-27 15:54:00 -0400 Processing by Exposition::PostsController#index as HTML Rendering /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application  (3.5ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 LIMIT $2 OFFSET $3) subquery_for_count [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Exposition::Post Load (18.0ms) SELECT "exposition_posts".* FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 ORDER BY "exposition_posts"."published_at" DESC LIMIT $2 OFFSET $3 [["published", true], ["LIMIT", 10], ["OFFSET", 0]] Categorical::Tag Exists (1.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 $3 [["taggable_id", 2], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (331.6ms) Categorical::Tag Exists (1.3ms) 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 $3 [["taggable_id", 1], ["taggable_type", "Exposition::Post"], ["LIMIT", 1]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/_tags.html.haml (9.3ms) Rendered collection of /Users/jklina/Development/exposition/app/views/exposition/posts/_post.html.haml [2 times] (465.9ms)  (2.1ms) SELECT COUNT(*) FROM "exposition_posts" WHERE "exposition_posts"."published" = $1 [["published", true]] Rendered /Users/jklina/Development/exposition/app/views/exposition/posts/index.html.haml within layouts/exposition/application (777.6ms) Completed 200 OK in 1282ms (Views: 1103.7ms | ActiveRecord: 26.6ms)