{"action":"created","comment":{"url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/pulls/comments/49080182","id":49080182,"diff_hunk":"@@ -159,7 +159,7 @@ def render_element(element, part = :view, options = {}, counter = 1)\n         locals: options.delete(:locals) || {}\n       }\n \n-      element.store_page(@page) if part.to_sym == :view\n+      element.store_page(@page) if part.to_sym == :view && Alchemy::Config.get(:cache_pages)","path":"app/helpers/alchemy/elements_helper.rb","position":5,"original_position":5,"commit_id":"f1a560f68e23d4f46f2c46db5d586d5a297f3b95","original_commit_id":"f1a560f68e23d4f46f2c46db5d586d5a297f3b95","user":{"login":"tvdeyen","id":42868,"avatar_url":"https://avatars.githubusercontent.com/u/42868?v=3","gravatar_id":"","url":"https://api.github.com/users/tvdeyen","html_url":"https://github.com/tvdeyen","followers_url":"https://api.github.com/users/tvdeyen/followers","following_url":"https://api.github.com/users/tvdeyen/following{/other_user}","gists_url":"https://api.github.com/users/tvdeyen/gists{/gist_id}","starred_url":"https://api.github.com/users/tvdeyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tvdeyen/subscriptions","organizations_url":"https://api.github.com/users/tvdeyen/orgs","repos_url":"https://api.github.com/users/tvdeyen/repos","events_url":"https://api.github.com/users/tvdeyen/events{/privacy}","received_events_url":"https://api.github.com/users/tvdeyen/received_events","type":"User","site_admin":false},"body":"We should ask if the `@page` needs to be cached or not. Using the global setting is ok, but will very unlikely turned off for the most sites. ","created_at":"2016-01-07T14:54:45Z","updated_at":"2016-01-07T14:54:45Z","html_url":"https://github.com/AlchemyCMS/alchemy_cms/pull/911#discussion_r49080182","pull_request_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/pulls/911","_links":{"self":{"href":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/pulls/comments/49080182"},"html":{"href":"https://github.com/AlchemyCMS/alchemy_cms/pull/911#discussion_r49080182"},"pull_request":{"href":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/pulls/911"}}},"pull_request":{"url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/pulls/911","id":55335989,"html_url":"https://github.com/AlchemyCMS/alchemy_cms/pull/911","diff_url":"https://github.com/AlchemyCMS/alchemy_cms/pull/911.diff","patch_url":"https://github.com/AlchemyCMS/alchemy_cms/pull/911.patch","issue_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/issues/911","number":911,"state":"open","locked":false,"title":"Eliminate an SQL lookup on frontend cached element partials","user":{"login":"mtomov","id":1651750,"avatar_url":"https://avatars.githubusercontent.com/u/1651750?v=3","gravatar_id":"","url":"https://api.github.com/users/mtomov","html_url":"https://github.com/mtomov","followers_url":"https://api.github.com/users/mtomov/followers","following_url":"https://api.github.com/users/mtomov/following{/other_user}","gists_url":"https://api.github.com/users/mtomov/gists{/gist_id}","starred_url":"https://api.github.com/users/mtomov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtomov/subscriptions","organizations_url":"https://api.github.com/users/mtomov/orgs","repos_url":"https://api.github.com/users/mtomov/repos","events_url":"https://api.github.com/users/mtomov/events{/privacy}","received_events_url":"https://api.github.com/users/mtomov/received_events","type":"User","site_admin":false},"body":"   * when not using page caching\r\n\r\n   When page_cache is not turned off, it is unnecessary to store the\r\n   element within the page it is being rendered using the `store_page`\r\n   method. Thereby, the method call is unnecessary, and avoiding it\r\n   saves an SQL query on every cached element render.\r\n\r\n```\r\n     Alchemy::Page Exists (2.2ms)  SELECT  DISTINCT 1 AS one FROM `alchemy_pages` INNER JOIN `alchemy_elements_alchemy_pages` ON `alchemy_pages`.`id` = `alchemy_elements_alchemy_pages`.`page_id` WHERE `alchemy_elements_alchemy_pages`.`element_id` = 569 AND `alchemy_pages`.`id` = 2 LIMIT 1\r\n```\r\n\r\n  So, if a non-cached page with N elements would result in N such queries.\r\n\r\n  This change saves those Exists lookups.\r\n\r\nLet me know if you prefer to place the pull request against 3.2 instead of master. \r\n\r\nSolves AlchemyCMS/alchemy_cms/issues/898\r\nThank you!","created_at":"2016-01-07T13:10:50Z","updated_at":"2016-01-07T14:54:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"666020559e07189336ee2e8a2cbd6c709151f6d1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/pulls/911/commits","review_comments_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/pulls/911/comments","review_comment_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/issues/911/comments","statuses_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/statuses/f1a560f68e23d4f46f2c46db5d586d5a297f3b95","head":{"label":"mtomov:eliminate-element-db-lookup-query","ref":"eliminate-element-db-lookup-query","sha":"f1a560f68e23d4f46f2c46db5d586d5a297f3b95","user":{"login":"mtomov","id":1651750,"avatar_url":"https://avatars.githubusercontent.com/u/1651750?v=3","gravatar_id":"","url":"https://api.github.com/users/mtomov","html_url":"https://github.com/mtomov","followers_url":"https://api.github.com/users/mtomov/followers","following_url":"https://api.github.com/users/mtomov/following{/other_user}","gists_url":"https://api.github.com/users/mtomov/gists{/gist_id}","starred_url":"https://api.github.com/users/mtomov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtomov/subscriptions","organizations_url":"https://api.github.com/users/mtomov/orgs","repos_url":"https://api.github.com/users/mtomov/repos","events_url":"https://api.github.com/users/mtomov/events{/privacy}","received_events_url":"https://api.github.com/users/mtomov/received_events","type":"User","site_admin":false},"repo":{"id":28695544,"name":"alchemy_cms","full_name":"mtomov/alchemy_cms","owner":{"login":"mtomov","id":1651750,"avatar_url":"https://avatars.githubusercontent.com/u/1651750?v=3","gravatar_id":"","url":"https://api.github.com/users/mtomov","html_url":"https://github.com/mtomov","followers_url":"https://api.github.com/users/mtomov/followers","following_url":"https://api.github.com/users/mtomov/following{/other_user}","gists_url":"https://api.github.com/users/mtomov/gists{/gist_id}","starred_url":"https://api.github.com/users/mtomov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtomov/subscriptions","organizations_url":"https://api.github.com/users/mtomov/orgs","repos_url":"https://api.github.com/users/mtomov/repos","events_url":"https://api.github.com/users/mtomov/events{/privacy}","received_events_url":"https://api.github.com/users/mtomov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mtomov/alchemy_cms","description":"Alchemy is a powerful, flexible and user centric Rails CMS.","fork":true,"url":"https://api.github.com/repos/mtomov/alchemy_cms","forks_url":"https://api.github.com/repos/mtomov/alchemy_cms/forks","keys_url":"https://api.github.com/repos/mtomov/alchemy_cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mtomov/alchemy_cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mtomov/alchemy_cms/teams","hooks_url":"https://api.github.com/repos/mtomov/alchemy_cms/hooks","issue_events_url":"https://api.github.com/repos/mtomov/alchemy_cms/issues/events{/number}","events_url":"https://api.github.com/repos/mtomov/alchemy_cms/events","assignees_url":"https://api.github.com/repos/mtomov/alchemy_cms/assignees{/user}","branches_url":"https://api.github.com/repos/mtomov/alchemy_cms/branches{/branch}","tags_url":"https://api.github.com/repos/mtomov/alchemy_cms/tags","blobs_url":"https://api.github.com/repos/mtomov/alchemy_cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mtomov/alchemy_cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mtomov/alchemy_cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/mtomov/alchemy_cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mtomov/alchemy_cms/statuses/{sha}","languages_url":"https://api.github.com/repos/mtomov/alchemy_cms/languages","stargazers_url":"https://api.github.com/repos/mtomov/alchemy_cms/stargazers","contributors_url":"https://api.github.com/repos/mtomov/alchemy_cms/contributors","subscribers_url":"https://api.github.com/repos/mtomov/alchemy_cms/subscribers","subscription_url":"https://api.github.com/repos/mtomov/alchemy_cms/subscription","commits_url":"https://api.github.com/repos/mtomov/alchemy_cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/mtomov/alchemy_cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/mtomov/alchemy_cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/mtomov/alchemy_cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/mtomov/alchemy_cms/contents/{+path}","compare_url":"https://api.github.com/repos/mtomov/alchemy_cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mtomov/alchemy_cms/merges","archive_url":"https://api.github.com/repos/mtomov/alchemy_cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mtomov/alchemy_cms/downloads","issues_url":"https://api.github.com/repos/mtomov/alchemy_cms/issues{/number}","pulls_url":"https://api.github.com/repos/mtomov/alchemy_cms/pulls{/number}","milestones_url":"https://api.github.com/repos/mtomov/alchemy_cms/milestones{/number}","notifications_url":"https://api.github.com/repos/mtomov/alchemy_cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mtomov/alchemy_cms/labels{/name}","releases_url":"https://api.github.com/repos/mtomov/alchemy_cms/releases{/id}","created_at":"2015-01-01T21:01:02Z","updated_at":"2015-01-01T21:01:03Z","pushed_at":"2016-01-07T13:10:12Z","git_url":"git://github.com/mtomov/alchemy_cms.git","ssh_url":"git@github.com:mtomov/alchemy_cms.git","clone_url":"https://github.com/mtomov/alchemy_cms.git","svn_url":"https://github.com/mtomov/alchemy_cms","homepage":"http://alchemy-cms.com","size":15560,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"AlchemyCMS:master","ref":"master","sha":"08c464ba1d663ed3bb99240366ecc5800cde6fd7","user":{"login":"AlchemyCMS","id":6218554,"avatar_url":"https://avatars.githubusercontent.com/u/6218554?v=3","gravatar_id":"","url":"https://api.github.com/users/AlchemyCMS","html_url":"https://github.com/AlchemyCMS","followers_url":"https://api.github.com/users/AlchemyCMS/followers","following_url":"https://api.github.com/users/AlchemyCMS/following{/other_user}","gists_url":"https://api.github.com/users/AlchemyCMS/gists{/gist_id}","starred_url":"https://api.github.com/users/AlchemyCMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlchemyCMS/subscriptions","organizations_url":"https://api.github.com/users/AlchemyCMS/orgs","repos_url":"https://api.github.com/users/AlchemyCMS/repos","events_url":"https://api.github.com/users/AlchemyCMS/events{/privacy}","received_events_url":"https://api.github.com/users/AlchemyCMS/received_events","type":"Organization","site_admin":false},"repo":{"id":1581769,"name":"alchemy_cms","full_name":"AlchemyCMS/alchemy_cms","owner":{"login":"AlchemyCMS","id":6218554,"avatar_url":"https://avatars.githubusercontent.com/u/6218554?v=3","gravatar_id":"","url":"https://api.github.com/users/AlchemyCMS","html_url":"https://github.com/AlchemyCMS","followers_url":"https://api.github.com/users/AlchemyCMS/followers","following_url":"https://api.github.com/users/AlchemyCMS/following{/other_user}","gists_url":"https://api.github.com/users/AlchemyCMS/gists{/gist_id}","starred_url":"https://api.github.com/users/AlchemyCMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlchemyCMS/subscriptions","organizations_url":"https://api.github.com/users/AlchemyCMS/orgs","repos_url":"https://api.github.com/users/AlchemyCMS/repos","events_url":"https://api.github.com/users/AlchemyCMS/events{/privacy}","received_events_url":"https://api.github.com/users/AlchemyCMS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AlchemyCMS/alchemy_cms","description":"Alchemy is a powerful, flexible and user centric Rails CMS.","fork":false,"url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms","forks_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/forks","keys_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/teams","hooks_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/hooks","issue_events_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/issues/events{/number}","events_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/events","assignees_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/assignees{/user}","branches_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/branches{/branch}","tags_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/tags","blobs_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/statuses/{sha}","languages_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/languages","stargazers_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/stargazers","contributors_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/contributors","subscribers_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/subscribers","subscription_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/subscription","commits_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/contents/{+path}","compare_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/merges","archive_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/downloads","issues_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/issues{/number}","pulls_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/pulls{/number}","milestones_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/milestones{/number}","notifications_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/labels{/name}","releases_url":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/releases{/id}","created_at":"2011-04-07T10:37:01Z","updated_at":"2015-12-30T20:42:21Z","pushed_at":"2016-01-07T13:10:50Z","git_url":"git://github.com/AlchemyCMS/alchemy_cms.git","ssh_url":"git@github.com:AlchemyCMS/alchemy_cms.git","clone_url":"https://github.com/AlchemyCMS/alchemy_cms.git","svn_url":"https://github.com/AlchemyCMS/alchemy_cms","homepage":"http://alchemy-cms.com","size":16724,"stargazers_count":368,"watchers_count":368,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":166,"mirror_url":null,"open_issues_count":29,"forks":166,"open_issues":29,"watchers":368,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/pulls/911"},"html":{"href":"https://github.com/AlchemyCMS/alchemy_cms/pull/911"},"issue":{"href":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/issues/911"},"comments":{"href":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/issues/911/comments"},"review_comments":{"href":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/pulls/911/comments"},"review_comment":{"href":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/pulls/911/commits"},"statuses":{"href":"https://api.github.com/repos/AlchemyCMS/alchemy_cms/statuses/f1a560f68e23d4f46f2c46db5d586d5a297f3b95"}}}}