{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/11662","labels_url":"https://api.github.com/repos/rails/rails/issues/11662/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/11662/comments","events_url":"https://api.github.com/repos/rails/rails/issues/11662/events","html_url":"https://github.com/rails/rails/issues/11662","id":17387181,"number":11662,"title":"rails 4: rendering template outside of controller raises exception in production","user":{"login":"pseidemann","id":431162,"avatar_url":"https://avatars.githubusercontent.com/u/431162?v=3","gravatar_id":"","url":"https://api.github.com/users/pseidemann","html_url":"https://github.com/pseidemann","followers_url":"https://api.github.com/users/pseidemann/followers","following_url":"https://api.github.com/users/pseidemann/following{/other_user}","gists_url":"https://api.github.com/users/pseidemann/gists{/gist_id}","starred_url":"https://api.github.com/users/pseidemann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pseidemann/subscriptions","organizations_url":"https://api.github.com/users/pseidemann/orgs","repos_url":"https://api.github.com/users/pseidemann/repos","events_url":"https://api.github.com/users/pseidemann/events{/privacy}","received_events_url":"https://api.github.com/users/pseidemann/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/actionview","name":"actionview","color":"d7e102"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2013-07-30T10:01:51Z","updated_at":"2016-01-21T17:13:03Z","closed_at":"2014-05-23T08:22:13Z","body":"hello,\r\n\r\nI want to render a template into a file in a rake task.\r\n\r\nthis was my old code (worked with rails 3):\r\n```ruby\r\ncontroller = ActionController::Base.new\r\nview = ActionView::Base.new('app/views', {}, controller)\r\nview.render(file: 'index')\r\n```\r\n\r\nin rails 4 (in production environment) that stopped working:\r\n```\r\nActionView::Template::Error: undefined method `parameters' for nil:NilClass\r\nfrom .../actionpack-4.0.0/lib/action_controller/metal/strong_parameters.rb:510:in `params'\r\n```\r\n\r\nthen I thought it would be good to simplify my code:\r\n\r\n```ruby\r\nActionView::Base.new('app/views').render(file: 'index')\r\n```\r\n\r\nbut this does not render asset pipeline file paths correctly.\r\n\r\nso this is my current workaround:\r\n```ruby\r\nActionController::Base.new.tap { |controller|\r\n  def controller.params\r\n    {} # suppress strong parameters exception\r\n  end\r\n}.render_to_string(file: filename)\r\n```\r\n\r\nis this a rails bug or I'm doing something wrong?\r\n\r\nthanks!"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/173640912","html_url":"https://github.com/rails/rails/issues/11662#issuecomment-173640912","issue_url":"https://api.github.com/repos/rails/rails/issues/11662","id":173640912,"user":{"login":"ro31337","id":1477672,"avatar_url":"https://avatars.githubusercontent.com/u/1477672?v=3","gravatar_id":"","url":"https://api.github.com/users/ro31337","html_url":"https://github.com/ro31337","followers_url":"https://api.github.com/users/ro31337/followers","following_url":"https://api.github.com/users/ro31337/following{/other_user}","gists_url":"https://api.github.com/users/ro31337/gists{/gist_id}","starred_url":"https://api.github.com/users/ro31337/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ro31337/subscriptions","organizations_url":"https://api.github.com/users/ro31337/orgs","repos_url":"https://api.github.com/users/ro31337/repos","events_url":"https://api.github.com/users/ro31337/events{/privacy}","received_events_url":"https://api.github.com/users/ro31337/received_events","type":"User","site_admin":false},"created_at":"2016-01-21T17:13:03Z","updated_at":"2016-01-21T17:13:03Z","body":"@justin808 the link is broken"}}