{"action":"created","comment":{"url":"https://api.github.com/repos/rails/rails/pulls/comments/23331958","id":23331958,"diff_hunk":"@@ -0,0 +1,66 @@\n+module ActionController\n+  class Renderer\n+    class_attribute :controller, :defaults\n+    attr_reader :env\n+\n+    class << self\n+      delegate :render, to: :new\n+\n+      def for(controller)","path":"actionpack/lib/action_controller/renderer.rb","position":9,"original_position":9,"commit_id":"98c3296eb7007c3a33644f66fc2458701e333adf","original_commit_id":"98c3296eb7007c3a33644f66fc2458701e333adf","user":{"login":"rafaelfranca","id":47848,"avatar_url":"https://avatars.githubusercontent.com/u/47848?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaelfranca","html_url":"https://github.com/rafaelfranca","followers_url":"https://api.github.com/users/rafaelfranca/followers","following_url":"https://api.github.com/users/rafaelfranca/following{/other_user}","gists_url":"https://api.github.com/users/rafaelfranca/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelfranca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelfranca/subscriptions","organizations_url":"https://api.github.com/users/rafaelfranca/orgs","repos_url":"https://api.github.com/users/rafaelfranca/repos","events_url":"https://api.github.com/users/rafaelfranca/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelfranca/received_events","type":"User","site_admin":false},"body":"Is this method public API?","created_at":"2015-01-21T20:34:12Z","updated_at":"2015-01-21T20:34:12Z","html_url":"https://github.com/rails/rails/pull/18546#discussion_r23331958","pull_request_url":"https://api.github.com/repos/rails/rails/pulls/18546","_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/23331958"},"html":{"href":"https://github.com/rails/rails/pull/18546#discussion_r23331958"},"pull_request":{"href":"https://api.github.com/repos/rails/rails/pulls/18546"}}},"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/18546","id":27459934,"html_url":"https://github.com/rails/rails/pull/18546","diff_url":"https://github.com/rails/rails/pull/18546.diff","patch_url":"https://github.com/rails/rails/pull/18546.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/18546","number":18546,"state":"open","locked":false,"title":"A shortcut to setup controller environment","user":{"login":"brainopia","id":386,"avatar_url":"https://avatars.githubusercontent.com/u/386?v=3","gravatar_id":"","url":"https://api.github.com/users/brainopia","html_url":"https://github.com/brainopia","followers_url":"https://api.github.com/users/brainopia/followers","following_url":"https://api.github.com/users/brainopia/following{/other_user}","gists_url":"https://api.github.com/users/brainopia/gists{/gist_id}","starred_url":"https://api.github.com/users/brainopia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brainopia/subscriptions","organizations_url":"https://api.github.com/users/brainopia/orgs","repos_url":"https://api.github.com/users/brainopia/repos","events_url":"https://api.github.com/users/brainopia/events{/privacy}","received_events_url":"https://api.github.com/users/brainopia/received_events","type":"User","site_admin":false},"body":"Related to #18409\r\n\r\nSome reiteration first.\r\nWhat we looking for is an easy way to render templates outside of controllers.\r\n\r\nView templates are rendered as part of request-response cycle. There are easy cases when templates would not depend on anything except ivars from controller, but a lot of templates use helpers that depend on request environment in one form or another.\r\n\r\nSometimes helpers depend on stuff that's easy to setup, like a scheme, host or script name. But request environment is also used by gems to hold transient data associated with current request (e.g., helpers from devise would raise an exception if request environment hasn't been prepared by its middleware).\r\n\r\nTherefore two use-cases arise.\r\n- Ability to render templates in custom request environment.\r\n- Ability to render templates in an environment that was passed through middleware stack. \r\n\r\nThis PR deals with the first part.\r\n\r\n```ruby\r\n# this would setup following environment keys: REQUEST_METHOD, SERVER_NAME, SERVER_PORT, QUERY_STRING, PATH_INFO, rack.url_scheme, HTTPS, rack.input\r\nFooController.setup_for(_uri_).render_to_string _render_options_  \r\n\r\n# or more detailed setup\r\ncontroller = FooController.setup_for _uri_, script_name: 'bar', method: 'post', 'env_key' => 'baz'\r\n... # configure controller instance a bit\r\ncontroller.render_to_string _render_options_ \r\n```\r\n\r\nWhere `_render_options_` could contain `assigns: { a: 'b' }` to set ivars.\r\n\r\n/cc @dhh ","created_at":"2015-01-15T20:35:30Z","updated_at":"2015-01-21T20:34:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7a8d43925aa65a55069632fea01d819a5126f32e","assignee":null,"milestone":{"url":"https://api.github.com/repos/rails/rails/milestones/34","labels_url":"https://api.github.com/repos/rails/rails/milestones/34/labels","id":665192,"number":34,"title":"5.0.0","description":null,"creator":{"login":"rafaelfranca","id":47848,"avatar_url":"https://avatars.githubusercontent.com/u/47848?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaelfranca","html_url":"https://github.com/rafaelfranca","followers_url":"https://api.github.com/users/rafaelfranca/followers","following_url":"https://api.github.com/users/rafaelfranca/following{/other_user}","gists_url":"https://api.github.com/users/rafaelfranca/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelfranca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelfranca/subscriptions","organizations_url":"https://api.github.com/users/rafaelfranca/orgs","repos_url":"https://api.github.com/users/rafaelfranca/repos","events_url":"https://api.github.com/users/rafaelfranca/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelfranca/received_events","type":"User","site_admin":false},"open_issues":94,"closed_issues":41,"state":"open","created_at":"2014-05-21T00:58:22Z","updated_at":"2015-01-21T17:04:01Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/rails/rails/pulls/18546/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/18546/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rails/rails/issues/18546/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/98c3296eb7007c3a33644f66fc2458701e333adf","head":{"label":"brainopia:action_view_render","ref":"action_view_render","sha":"98c3296eb7007c3a33644f66fc2458701e333adf","user":{"login":"brainopia","id":386,"avatar_url":"https://avatars.githubusercontent.com/u/386?v=3","gravatar_id":"","url":"https://api.github.com/users/brainopia","html_url":"https://github.com/brainopia","followers_url":"https://api.github.com/users/brainopia/followers","following_url":"https://api.github.com/users/brainopia/following{/other_user}","gists_url":"https://api.github.com/users/brainopia/gists{/gist_id}","starred_url":"https://api.github.com/users/brainopia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brainopia/subscriptions","organizations_url":"https://api.github.com/users/brainopia/orgs","repos_url":"https://api.github.com/users/brainopia/repos","events_url":"https://api.github.com/users/brainopia/events{/privacy}","received_events_url":"https://api.github.com/users/brainopia/received_events","type":"User","site_admin":false},"repo":{"id":28490135,"name":"rails","full_name":"brainopia/rails","owner":{"login":"brainopia","id":386,"avatar_url":"https://avatars.githubusercontent.com/u/386?v=3","gravatar_id":"","url":"https://api.github.com/users/brainopia","html_url":"https://github.com/brainopia","followers_url":"https://api.github.com/users/brainopia/followers","following_url":"https://api.github.com/users/brainopia/following{/other_user}","gists_url":"https://api.github.com/users/brainopia/gists{/gist_id}","starred_url":"https://api.github.com/users/brainopia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brainopia/subscriptions","organizations_url":"https://api.github.com/users/brainopia/orgs","repos_url":"https://api.github.com/users/brainopia/repos","events_url":"https://api.github.com/users/brainopia/events{/privacy}","received_events_url":"https://api.github.com/users/brainopia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brainopia/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/brainopia/rails","forks_url":"https://api.github.com/repos/brainopia/rails/forks","keys_url":"https://api.github.com/repos/brainopia/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brainopia/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brainopia/rails/teams","hooks_url":"https://api.github.com/repos/brainopia/rails/hooks","issue_events_url":"https://api.github.com/repos/brainopia/rails/issues/events{/number}","events_url":"https://api.github.com/repos/brainopia/rails/events","assignees_url":"https://api.github.com/repos/brainopia/rails/assignees{/user}","branches_url":"https://api.github.com/repos/brainopia/rails/branches{/branch}","tags_url":"https://api.github.com/repos/brainopia/rails/tags","blobs_url":"https://api.github.com/repos/brainopia/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brainopia/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brainopia/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/brainopia/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brainopia/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/brainopia/rails/languages","stargazers_url":"https://api.github.com/repos/brainopia/rails/stargazers","contributors_url":"https://api.github.com/repos/brainopia/rails/contributors","subscribers_url":"https://api.github.com/repos/brainopia/rails/subscribers","subscription_url":"https://api.github.com/repos/brainopia/rails/subscription","commits_url":"https://api.github.com/repos/brainopia/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/brainopia/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/brainopia/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/brainopia/rails/issues/comments/{number}","contents_url":"https://api.github.com/repos/brainopia/rails/contents/{+path}","compare_url":"https://api.github.com/repos/brainopia/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brainopia/rails/merges","archive_url":"https://api.github.com/repos/brainopia/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brainopia/rails/downloads","issues_url":"https://api.github.com/repos/brainopia/rails/issues{/number}","pulls_url":"https://api.github.com/repos/brainopia/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/brainopia/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/brainopia/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brainopia/rails/labels{/name}","releases_url":"https://api.github.com/repos/brainopia/rails/releases{/id}","created_at":"2014-12-25T20:02:14Z","updated_at":"2015-01-20T11:44:04Z","pushed_at":"2015-01-21T20:02:30Z","git_url":"git://github.com/brainopia/rails.git","ssh_url":"git@github.com:brainopia/rails.git","clone_url":"https://github.com/brainopia/rails.git","svn_url":"https://github.com/brainopia/rails","homepage":"http://rubyonrails.org","size":126819,"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":"rails:master","ref":"master","sha":"e8460f8bbe73537897f2162d1cccda943d8c0f4a","user":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"repo":{"id":8514,"name":"rails","full_name":"rails/rails","owner":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rails/rails","description":"Ruby on Rails","fork":false,"url":"https://api.github.com/repos/rails/rails","forks_url":"https://api.github.com/repos/rails/rails/forks","keys_url":"https://api.github.com/repos/rails/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rails/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rails/rails/teams","hooks_url":"https://api.github.com/repos/rails/rails/hooks","issue_events_url":"https://api.github.com/repos/rails/rails/issues/events{/number}","events_url":"https://api.github.com/repos/rails/rails/events","assignees_url":"https://api.github.com/repos/rails/rails/assignees{/user}","branches_url":"https://api.github.com/repos/rails/rails/branches{/branch}","tags_url":"https://api.github.com/repos/rails/rails/tags","blobs_url":"https://api.github.com/repos/rails/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rails/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rails/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/rails/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rails/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/rails/rails/languages","stargazers_url":"https://api.github.com/repos/rails/rails/stargazers","contributors_url":"https://api.github.com/repos/rails/rails/contributors","subscribers_url":"https://api.github.com/repos/rails/rails/subscribers","subscription_url":"https://api.github.com/repos/rails/rails/subscription","commits_url":"https://api.github.com/repos/rails/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/rails/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/rails/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/rails/rails/issues/comments/{number}","contents_url":"https://api.github.com/repos/rails/rails/contents/{+path}","compare_url":"https://api.github.com/repos/rails/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rails/rails/merges","archive_url":"https://api.github.com/repos/rails/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rails/rails/downloads","issues_url":"https://api.github.com/repos/rails/rails/issues{/number}","pulls_url":"https://api.github.com/repos/rails/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/rails/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/rails/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rails/rails/labels{/name}","releases_url":"https://api.github.com/repos/rails/rails/releases{/id}","created_at":"2008-04-11T02:19:47Z","updated_at":"2015-01-21T19:50:20Z","pushed_at":"2015-01-21T18:49:20Z","git_url":"git://github.com/rails/rails.git","ssh_url":"git@github.com:rails/rails.git","clone_url":"https://github.com/rails/rails.git","svn_url":"https://github.com/rails/rails","homepage":"http://rubyonrails.org","size":360869,"stargazers_count":24650,"watchers_count":24650,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":9538,"mirror_url":null,"open_issues_count":773,"forks":9538,"open_issues":773,"watchers":24650,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/18546"},"html":{"href":"https://github.com/rails/rails/pull/18546"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/18546"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/18546/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/18546/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/18546/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/98c3296eb7007c3a33644f66fc2458701e333adf"}}}}