Skip to content

Instantly share code, notes, and snippets.

@aronlindberg
Created February 9, 2015 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aronlindberg/848b8efef154d0e7fdb4 to your computer and use it in GitHub Desktop.
Save aronlindberg/848b8efef154d0e7fdb4 to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
list(structure(list(ok = TRUE, content = list(structure(list(
sha = "2e39d0dbc2e1cccac2f2735fcf4534f9ff2f1e21", filename = "actionpack/lib/action_dispatch/http/url.rb",
status = "modified", additions = 6L, deletions = 4L, changes = 10L,
blob_url = "https://github.com/rails/rails/blob/797b8c2d13593d3c286cb7943c29df6928d397fa/actionpack/lib/action_dispatch/http/url.rb",
raw_url = "https://github.com/rails/rails/raw/797b8c2d13593d3c286cb7943c29df6928d397fa/actionpack/lib/action_dispatch/http/url.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_dispatch/http/url.rb?ref=797b8c2d13593d3c286cb7943c29df6928d397fa",
patch = "@@ -1,7 +1,9 @@\n module ActionDispatch\n module Http\n module URL\n- # Returns the complete \\URL used for this request.\n+ mattr_accessor :tld_length\n+\n+ # Returns the complete URL used for this request.\n def url\n protocol + host_with_port + fullpath\n end\n@@ -85,13 +87,13 @@ def domain(tld_length = 1)\n # returned for \"dev.www.rubyonrails.org\". You can specify a different <tt>tld_length</tt>,\n # such as 2 to catch <tt>[\"www\"]</tt> instead of <tt>[\"www\", \"rubyonrails\"]</tt>\n # in \"www.rubyonrails.co.uk\".\n- def subdomains(tld_length = 1)\n+ def subdomains(tld_length = @@tld_length)\n return [] unless named_host?(host)\n parts = host.split('.')\n parts[0..-(tld_length+2)]\n end\n \n- def subdomain(tld_length = 1)\n+ def subdomain(tld_length = @@tld_length)\n subdomains(tld_length).join('.')\n end\n \n@@ -102,4 +104,4 @@ def named_host?(host)\n end\n end\n end\n-end\n+end\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c202fee990f930a93453c4ecbea1f37aa716314c",
filename = "actionpack/lib/action_dispatch/railtie.rb", status = "modified",
additions = 10L, deletions = 0L, changes = 10L, blob_url = "https://github.com/rails/rails/blob/797b8c2d13593d3c286cb7943c29df6928d397fa/actionpack/lib/action_dispatch/railtie.rb",
raw_url = "https://github.com/rails/rails/raw/797b8c2d13593d3c286cb7943c29df6928d397fa/actionpack/lib/action_dispatch/railtie.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_dispatch/railtie.rb?ref=797b8c2d13593d3c286cb7943c29df6928d397fa",
patch = "@@ -8,5 +8,15 @@ class Railtie < Rails::Railtie\n config.action_dispatch.ip_spoofing_check = true\n config.action_dispatch.show_exceptions = true\n config.action_dispatch.best_standards_support = true\n+ config.action_dispatch.tld_length = 1\n+\n+ # Prepare dispatcher callbacks and run 'prepare' callbacks\n+ initializer \"action_dispatch.prepare_dispatcher\" do |app|\n+ ActionDispatch::Callbacks.to_prepare { app.routes_reloader.execute_if_updated }\n+ end\n+\n+ initializer \"action_dispatch.configure\" do |app|\n+ ActionDispatch::Http::URL.tld_length = app.config.action_dispatch.tld_length\n+ end\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "a8b8f9377bcd25effd9ed9039f2f039805be92cc",
filename = "actionpack/test/dispatch/request_test.rb", status = "modified",
additions = 5L, deletions = 0L, changes = 5L, blob_url = "https://github.com/rails/rails/blob/797b8c2d13593d3c286cb7943c29df6928d397fa/actionpack/test/dispatch/request_test.rb",
raw_url = "https://github.com/rails/rails/raw/797b8c2d13593d3c286cb7943c29df6928d397fa/actionpack/test/dispatch/request_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/dispatch/request_test.rb?ref=797b8c2d13593d3c286cb7943c29df6928d397fa",
patch = "@@ -116,6 +116,9 @@ class RequestTest < ActiveSupport::TestCase\n request = stub_request 'HTTP_HOST' => \"dev.www.rubyonrails.co.uk\"\n assert_equal %w( dev www ), request.subdomains(2)\n \n+ request = stub_request 'HTTP_HOST' => \"dev.www.rubyonrails.co.uk\", :tld_length => 2\n+ assert_equal %w( dev www ), request.subdomains\n+\n request = stub_request 'HTTP_HOST' => \"foobar.foobar.com\"\n assert_equal %w( foobar ), request.subdomains\n \n@@ -472,7 +475,9 @@ class RequestTest < ActiveSupport::TestCase\n def stub_request(env = {})\n ip_spoofing_check = env.key?(:ip_spoofing_check) ? env.delete(:ip_spoofing_check) : true\n ip_app = ActionDispatch::RemoteIp.new(Proc.new { }, ip_spoofing_check, @trusted_proxies)\n+ tld_length = env.key?(:tld_length) ? env.delete(:tld_length) : 1\n ip_app.call(env)\n+ ActionDispatch::Http::URL.tld_length = tld_length\n ActionDispatch::Request.new(env)\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "61340e82c3b40dfd2d36fe56b637b1ee115fa227",
filename = "railties/test/application/initializers/frameworks_test.rb",
status = "modified", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/797b8c2d13593d3c286cb7943c29df6928d397fa/railties/test/application/initializers/frameworks_test.rb",
raw_url = "https://github.com/rails/rails/raw/797b8c2d13593d3c286cb7943c29df6928d397fa/railties/test/application/initializers/frameworks_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/application/initializers/frameworks_test.rb?ref=797b8c2d13593d3c286cb7943c29df6928d397fa",
patch = "@@ -65,6 +65,13 @@ def notify\n assert_equal [\"notify\"], Foo.action_methods\n end\n \n+ # AD\n+ test \"action_dispatch extensions are applied to ActionDispatch\" do\n+ add_to_config \"config.action_dispatch.tld_length = 2\"\n+ require \"#{app_path}/config/environment\"\n+ assert_equal 2, ActionDispatch::Http::URL.tld_length\n+ end\n+\n # AS\n test \"if there's no config.active_support.bare, all of ActiveSupport is required\" do\n use_frameworks []"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:49 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 17:09:37 GMT",
etag = "\"91171a34e18c793751e06b8975ae762a\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248121:54D9023D",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "d594a23ec74671eba905bf91ef329026"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "9504661c0e0c578fb9808b10a5e8e5fbdff6c543", filename = "railties/Rakefile",
status = "modified", additions = 3L, deletions = 2L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/Rakefile",
raw_url = "https://github.com/rails/rails/raw/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/Rakefile?ref=6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da",
patch = "@@ -45,8 +45,9 @@ task :generate_guides do\n ruby \"guides/rails_guides.rb\"\n end\n \n-task :update_prototype_ujs do\n- system \"curl http://github.com/rails/prototype-ujs/raw/master/src/rails.js > lib/rails/generators/rails/app/templates/public/javascripts/rails.js\"\n+task :update_ujs do\n+ system \"curl http://github.com/rails/prototype-ujs/raw/master/src/rails.js > lib/rails/generators/rails/app/templates/public/javascripts/prototype_ujs.js\"\n+ system \"curl http://github.com/rails/jquery-ujs/raw/master/src/rails.js > lib/rails/generators/rails/app/templates/public/javascripts/jquery_ujs.js\"\n end\n \n # Validate guides -------------------------------------------------------------------------"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "279ffec1a2147f040bc7367730a66cb7c8e896df",
filename = "railties/lib/rails/generators/rails/app/app_generator.rb",
status = "modified", additions = 26L, deletions = 8L, changes = 34L,
blob_url = "https://github.com/rails/rails/blob/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/app_generator.rb",
raw_url = "https://github.com/rails/rails/raw/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/app_generator.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/app_generator.rb?ref=6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da",
patch = "@@ -111,12 +111,22 @@ def stylesheets\n end\n \n def javascripts\n- unless options[:skip_prototype]\n- directory \"public/javascripts\"\n- else\n- empty_directory_with_gitkeep \"public/javascripts\"\n- create_file \"public/javascripts/application.js\"\n+ empty_directory \"public/javascripts\"\n+ \n+ unless options[:skip_javascript]\n+ copy_file \"public/javascripts/#{@options[:javascript]}.js\"\n+ \n+ copy_file \"public/javascripts/#{@options[:javascript]}_ujs.js\", \"public/javascripts/rails.js\"\n+ copy_file \"public/javascripts/#{@options[:javascript]}_ujs.js\", \"public/javascripts/rails.js\"\n+ \n+ if options[:prototype]\n+ copy_file \"public/javascripts/controls.js\"\n+ copy_file \"public/javascripts/dragdrop.js\"\n+ copy_file \"public/javascripts/effects.js\"\n+ end\n end\n+ \n+ copy_file \"public/javascripts/application.js\"\n end\n \n def script\n@@ -155,6 +165,7 @@ module Generators\n \n class AppGenerator < Base\n DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db )\n+ JAVASCRIPTS = %w( prototype jquery )\n \n attr_accessor :rails_template\n add_shebang_option!\n@@ -164,6 +175,9 @@ class AppGenerator < Base\n class_option :database, :type => :string, :aliases => \"-d\", :default => \"sqlite3\",\n :desc => \"Preconfigure for selected database (options: #{DATABASES.join('/')})\"\n \n+ class_option :javascript, :type => :string, :aliases => \"-j\", :default => \"prototype\",\n+ :desc => \"Preconfigure for selected javascript library (options: #{JAVASCRIPTS.join('/')})\"\n+\n class_option :builder, :type => :string, :aliases => \"-b\",\n :desc => \"Path to an application builder (can be a filesystem path or URL)\"\n \n@@ -185,8 +199,8 @@ class AppGenerator < Base\n class_option :skip_test_unit, :type => :boolean, :aliases => \"-T\", :default => false,\n :desc => \"Skip Test::Unit files\"\n \n- class_option :skip_prototype, :type => :boolean, :aliases => \"-J\", :default => false,\n- :desc => \"Skip Prototype files\"\n+ class_option :skip_javascript, :type => :boolean, :aliases => \"-J\", :default => false,\n+ :desc => \"Skip javascript files\"\n \n class_option :skip_git, :type => :boolean, :aliases => \"-G\", :default => false,\n :desc => \"Skip Git ignores and keeps\"\n@@ -208,6 +222,10 @@ def initialize(*args)\n if !options[:skip_active_record] && !DATABASES.include?(options[:database])\n raise Error, \"Invalid value for --database option. Supported for preconfiguration are: #{DATABASES.join(\", \")}.\"\n end\n+ \n+ if !options[:skip_javascript] && !JAVASCRIPTS.include?(options[:javascript])\n+ raise Error, \"Invalid value for --javascript option. Supported for preconfiguration are: #{JAVASCRIPTS.join(\", \")}.\"\n+ end\n end\n \n def create_root\n@@ -272,7 +290,7 @@ def create_public_stylesheets_files\n build(:stylesheets)\n end\n \n- def create_prototype_files\n+ def create_javascript_files\n build(:javascripts)\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "00a23a7b89c29131b7751825950737e8e75b10cb",
filename = "railties/lib/rails/generators/rails/app/templates/config/application.rb",
status = "modified", additions = 3L, deletions = 1L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/templates/config/application.rb",
raw_url = "https://github.com/rails/rails/raw/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/templates/config/application.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/config/application.rb?ref=6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da",
patch = "@@ -40,8 +40,10 @@ class Application < Rails::Application\n # config.i18n.default_locale = :de\n \n # JavaScript files you want as :defaults (application.js is always included).\n-<% if options[:skip_prototype] -%>\n+<% if options[:skip_javascript] -%>\n config.action_view.javascript_expansions[:defaults] = %w()\n+<% elsif options[:javascript] == 'jquery' -%>\n+ config.action_view.javascript_expansions[:defaults] = %w(jquery rails)\n <% else -%>\n # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)\n <% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "109701084e4bd6790b286efedd86fac1f828a839",
filename = "railties/lib/rails/generators/rails/app/templates/public/javascripts/jquery.js",
status = "added", additions = 6078L, deletions = 0L, changes = 6078L,
blob_url = "https://github.com/rails/rails/blob/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/templates/public/javascripts/jquery.js",
raw_url = "https://github.com/rails/rails/raw/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/templates/public/javascripts/jquery.js",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/public/javascripts/jquery.js?ref=6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url")), structure(list(sha = "776588addc1e5df5f4cf3f3cbd44b205354e395b",
filename = "railties/lib/rails/generators/rails/app/templates/public/javascripts/jquery_ujs.js",
status = "added", additions = 132L, deletions = 0L, changes = 132L,
blob_url = "https://github.com/rails/rails/blob/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/templates/public/javascripts/jquery_ujs.js",
raw_url = "https://github.com/rails/rails/raw/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/templates/public/javascripts/jquery_ujs.js",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/public/javascripts/jquery_ujs.js?ref=6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da",
patch = "@@ -0,0 +1,132 @@\n+jQuery(function ($) {\r\n+ var csrf_token = $('meta[name=csrf-token]').attr('content'),\r\n+ csrf_param = $('meta[name=csrf-param]').attr('content');\r\n+\r\n+ $.fn.extend({\r\n+ /**\r\n+ * Triggers a custom event on an element and returns the event result\r\n+ * this is used to get around not being able to ensure callbacks are placed\r\n+ * at the end of the chain.\r\n+ *\r\n+ * TODO: deprecate with jQuery 1.4.2 release, in favor of subscribing to our\r\n+ * own events and placing ourselves at the end of the chain.\r\n+ */\r\n+ triggerAndReturn: function (name, data) {\r\n+ var event = new $.Event(name);\r\n+ this.trigger(event, data);\r\n+\r\n+ return event.result !== false;\r\n+ },\r\n+\r\n+ /**\r\n+ * Handles execution of remote calls firing overridable events along the way\r\n+ */\r\n+ callRemote: function () {\r\n+ var el = this,\r\n+ method = el.attr('method') || el.attr('data-method') || 'GET',\r\n+ url = el.attr('action') || el.attr('href'),\r\n+ dataType = el.attr('data-type') || 'script';\r\n+\r\n+ if (url === undefined) {\r\n+ throw \"No URL specified for remote call (action or href must be present).\";\r\n+ } else {\r\n+ if (el.triggerAndReturn('ajax:before')) {\r\n+ var data = el.is('form') ? el.serializeArray() : [];\r\n+ $.ajax({\r\n+ url: url,\r\n+ data: data,\r\n+ dataType: dataType,\r\n+ type: method.toUpperCase(),\r\n+ beforeSend: function (xhr) {\r\n+ el.trigger('ajax:loading', xhr);\r\n+ },\r\n+ success: function (data, status, xhr) {\r\n+ el.trigger('ajax:success', [data, status, xhr]);\r\n+ },\r\n+ complete: function (xhr) {\r\n+ el.trigger('ajax:complete', xhr);\r\n+ },\r\n+ error: function (xhr, status, error) {\r\n+ el.trigger('ajax:failure', [xhr, status, error]);\r\n+ }\r\n+ });\r\n+ }\r\n+\r\n+ el.trigger('ajax:after');\r\n+ }\r\n+ }\r\n+ });\r\n+\r\n+ /**\r\n+ * confirmation handler\r\n+ */\r\n+ $('a[data-confirm],input[data-confirm]').live('click', function () {\r\n+ var el = $(this);\r\n+ if (el.triggerAndReturn('confirm')) {\r\n+ if (!confirm(el.attr('data-confirm'))) {\r\n+ return false;\r\n+ }\r\n+ }\r\n+ });\r\n+\r\n+\r\n+ /**\r\n+ * remote handlers\r\n+ */\r\n+ $('form[data-remote]').live('submit', function (e) {\r\n+ $(this).callRemote();\r\n+ e.preventDefault();\r\n+ });\r\n+\r\n+ $('a[data-remote],input[data-remote]').live('click', function (e) {\r\n+ $(this).callRemote();\r\n+ e.preventDefault();\r\n+ });\r\n+\r\n+ $('a[data-method]:not([data-remote])').live('click', function (e){\r\n+ var link = $(this),\r\n+ href = link.attr('href'),\r\n+ method = link.attr('data-method'),\r\n+ form = $('<form method=\"post\" action=\"'+href+'\"></form>'),\r\n+ metadata_input = '<input name=\"_method\" value=\"'+method+'\" type=\"hidden\" />';\r\n+\r\n+ if (csrf_param != null && csrf_token != null) {\r\n+ metadata_input += '<input name=\"'+csrf_param+'\" value=\"'+csrf_token+'\" type=\"hidden\" />';\r\n+ }\r\n+\r\n+ form.hide()\r\n+ .append(metadata_input)\r\n+ .appendTo('body');\r\n+\r\n+ e.preventDefault();\r\n+ form.submit();\r\n+ });\r\n+\r\n+ /**\r\n+ * disable-with handlers\r\n+ */\r\n+ var disable_with_input_selector = 'input[data-disable-with]';\r\n+ var disable_with_form_remote_selector = 'form[data-remote]:has(' + disable_with_input_selector + ')';\r\n+ var disable_with_form_not_remote_selector = 'form:not([data-remote]):has(' + disable_with_input_selector + ')';\r\n+\r\n+ var disable_with_input_function = function () {\r\n+ $(this).find(disable_with_input_selector).each(function () {\r\n+ var input = $(this);\r\n+ input.data('enable-with', input.val())\r\n+ .attr('value', input.attr('data-disable-with'))\r\n+ .attr('disabled', 'disabled');\r\n+ });\r\n+ };\r\n+\r\n+ $(disable_with_form_remote_selector).live('ajax:before', disable_with_input_function);\r\n+ $(disable_with_form_not_remote_selector).live('submit', disable_with_input_function);\r\n+\r\n+ $(disable_with_form_remote_selector).live('ajax:complete', function () {\r\n+ $(this).find(disable_with_input_selector).each(function () {\r\n+ var input = $(this);\r\n+ input.removeAttr('disabled')\r\n+ .val(input.data('enable-with'));\r\n+ });\r\n+ });\r\n+\r\n+});\r"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "fc69f93c583d1585e5f899d1cb8af31fb08edd18",
filename = "railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype_ujs.js",
status = "renamed", additions = 44L, deletions = 41L, changes = 85L,
blob_url = "https://github.com/rails/rails/blob/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype_ujs.js",
raw_url = "https://github.com/rails/rails/raw/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype_ujs.js",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype_ujs.js?ref=6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da",
patch = "@@ -14,33 +14,33 @@\n }\n \n function isForm(element) {\n- return Object.isElement(element) && element.nodeName.toUpperCase() == 'FORM'\n+ return Object.isElement(element) && element.nodeName.toUpperCase() == 'FORM';\n }\n \n function isInput(element) {\n if (Object.isElement(element)) {\n- var name = element.nodeName.toUpperCase()\n- return name == 'INPUT' || name == 'SELECT' || name == 'TEXTAREA'\n+ var name = element.nodeName.toUpperCase();\n+ return name == 'INPUT' || name == 'SELECT' || name == 'TEXTAREA';\n }\n- else return false\n+ else return false;\n }\n \n var submitBubbles = isEventSupported('submit'),\n- changeBubbles = isEventSupported('change')\n+ changeBubbles = isEventSupported('change');\n \n if (!submitBubbles || !changeBubbles) {\n // augment the Event.Handler class to observe custom events when needed\n Event.Handler.prototype.initialize = Event.Handler.prototype.initialize.wrap(\n function(init, element, eventName, selector, callback) {\n- init(element, eventName, selector, callback)\n+ init(element, eventName, selector, callback);\n // is the handler being attached to an element that doesn't support this event?\n if ( (!submitBubbles && this.eventName == 'submit' && !isForm(this.element)) ||\n (!changeBubbles && this.eventName == 'change' && !isInput(this.element)) ) {\n // \"submit\" => \"emulated:submit\"\n- this.eventName = 'emulated:' + this.eventName\n+ this.eventName = 'emulated:' + this.eventName;\n }\n }\n- )\n+ );\n }\n \n if (!submitBubbles) {\n@@ -49,26 +49,26 @@\n // special handler for the real \"submit\" event (one-time operation)\n if (!form.retrieve('emulated:submit')) {\n form.on('submit', function(submitEvent) {\n- var emulated = form.fire('emulated:submit', submitEvent, true)\n+ var emulated = form.fire('emulated:submit', submitEvent, true);\n // if custom event received preventDefault, cancel the real one too\n- if (emulated.returnValue === false) submitEvent.preventDefault()\n- })\n- form.store('emulated:submit', true)\n+ if (emulated.returnValue === false) submitEvent.preventDefault();\n+ });\n+ form.store('emulated:submit', true);\n }\n- })\n+ });\n }\n \n if (!changeBubbles) {\n // discover form inputs on the page\n- document.on('focusin', 'input, select, texarea', function(focusEvent, input) {\n+ document.on('focusin', 'input, select, textarea', function(focusEvent, input) {\n // special handler for real \"change\" events\n if (!input.retrieve('emulated:change')) {\n input.on('change', function(changeEvent) {\n- input.fire('emulated:change', changeEvent, true)\n- })\n- input.store('emulated:change', true)\n+ input.fire('emulated:change', changeEvent, true);\n+ });\n+ input.store('emulated:change', true);\n }\n- })\n+ });\n }\n \n function handleRemote(element) {\n@@ -80,7 +80,10 @@\n if (element.tagName.toLowerCase() === 'form') {\n method = element.readAttribute('method') || 'post';\n url = element.readAttribute('action');\n- params = element.serialize();\n+ // serialize the form with respect to the submit button that was pressed\n+ params = element.serialize({ submit: element.retrieve('rails:submit-button') });\n+ // clear the pressed submit button information\n+ element.store('rails:submit-button', null);\n } else {\n method = element.readAttribute('data-method') || 'get';\n url = element.readAttribute('href');\n@@ -100,6 +103,10 @@\n element.fire(\"ajax:after\");\n }\n \n+ function insertHiddenField(form, name, value) {\n+ form.insert(new Element('input', { type: 'hidden', name: name, value: value }));\n+ }\n+\n function handleMethod(element) {\n var method = element.readAttribute('data-method'),\n url = element.readAttribute('href'),\n@@ -110,15 +117,11 @@\n element.parentNode.insert(form);\n \n if (method !== 'post') {\n- var field = new Element('input', { type: 'hidden', name: '_method', value: method });\n- form.insert(field);\n+ insertHiddenField(form, '_method', method);\n }\n \n if (csrf_param) {\n- var param = csrf_param.readAttribute('content'),\n- token = csrf_token.readAttribute('content'),\n- field = new Element('input', { type: 'hidden', name: param, value: token });\n- form.insert(field);\n+ insertHiddenField(form, csrf_param.readAttribute('content'), csrf_token.readAttribute('content'));\n }\n \n form.submit();\n@@ -142,34 +145,34 @@\n event.stop();\n });\n \n+ document.on(\"click\", \"form input[type=submit]\", function(event, button) {\n+ // register the pressed submit button\n+ event.findElement('form').store('rails:submit-button', button.name || false);\n+ });\n+\n document.on(\"submit\", function(event) {\n- var element = event.findElement(),\n- message = element.readAttribute('data-confirm');\n+ var form = event.findElement(),\n+ message = form.readAttribute('data-confirm');\n+\n if (message && !confirm(message)) {\n event.stop();\n return false;\n }\n \n- var inputs = element.select(\"input[type=submit][data-disable-with]\");\n- inputs.each(function(input) {\n- input.disabled = true;\n- input.writeAttribute('data-original-value', input.value);\n- input.value = input.readAttribute('data-disable-with');\n+ form.select('input[type=submit][data-disable-with]').each(function(input) {\n+ input.store('rails:original-value', input.getValue());\n+ input.disable().setValue(input.readAttribute('data-disable-with'));\n });\n \n- var element = event.findElement(\"form[data-remote]\");\n- if (element) {\n- handleRemote(element);\n+ if (form.readAttribute('data-remote')) {\n+ handleRemote(form);\n event.stop();\n }\n });\n \n- document.on(\"ajax:after\", \"form\", function(event, element) {\n- var inputs = element.select(\"input[type=submit][disabled=true][data-disable-with]\");\n- inputs.each(function(input) {\n- input.value = input.readAttribute('data-original-value');\n- input.removeAttribute('data-original-value');\n- input.disabled = false;\n+ document.on(\"ajax:after\", \"form\", function(event, form) {\n+ form.select('input[type=submit][data-disable-with]').each(function(input) {\n+ input.setValue(input.retrieve('rails:original-value')).enable();\n });\n });\n })();"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "5222b7bf502c51052827c50ac296ff0950649356",
filename = "railties/lib/rails/tasks/framework.rake", status = "modified",
additions = 1L, deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/tasks/framework.rake",
raw_url = "https://github.com/rails/rails/raw/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/lib/rails/tasks/framework.rake",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/tasks/framework.rake?ref=6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da",
patch = "@@ -60,7 +60,7 @@ namespace :rails do\n \n # desc \"Update Prototype javascripts from your current rails install\"\n task :javascripts do\n- invoke_from_app_generator :create_prototype_files\n+ invoke_from_app_generator :create_javascript_files\n end\n \n # desc \"Adds new scripts to the application script/ directory\""), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "dd3cf7593c0a9d3f3ee118904ae55c47974c248b",
filename = "railties/test/generators/app_generator_test.rb",
status = "modified", additions = 24L, deletions = 4L, changes = 28L,
blob_url = "https://github.com/rails/rails/blob/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/test/generators/app_generator_test.rb",
raw_url = "https://github.com/rails/rails/raw/6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da/railties/test/generators/app_generator_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/generators/app_generator_test.rb?ref=6b52630ff6d7b1cd641f9f9ee1ffa58409b1a5da",
patch = "@@ -180,14 +180,34 @@ def test_prototype_and_test_unit_are_added_by_default\n assert_file \"public/javascripts/rails.js\"\n assert_file \"test\"\n end\n-\n- def test_prototype_and_test_unit_are_skipped_if_required\n- run_generator [destination_root, \"--skip-prototype\", \"--skip-test-unit\"]\n+ \n+ def test_test_unit_is_skipped_if_required\n+ run_generator [destination_root, \"--skip-test-unit\"]\n+ assert_no_file \"test\" \n+ end\n+ \n+ def test_javascript_is_skipped_if_required\n+ run_generator [destination_root, \"--skip-javascript\"]\n assert_file \"config/application.rb\", /^\\s+config\\.action_view\\.javascript_expansions\\[:defaults\\]\\s+=\\s+%w\\(\\)/\n assert_file \"public/javascripts/application.js\"\n assert_no_file \"public/javascripts/prototype.js\"\n assert_no_file \"public/javascripts/rails.js\"\n- assert_no_file \"test\"\n+ end\n+ \n+ def test_config_prototype_javascript_library\n+ run_generator [destination_root, \"-j\", \"prototype\"]\n+ assert_file \"config/application.rb\", /#\\s+config\\.action_view\\.javascript_expansions\\[:defaults\\]\\s+=\\s+%w\\(jquery rails\\)/\n+ assert_file \"public/javascripts/application.js\"\n+ assert_file \"public/javascripts/prototype.js\"\n+ assert_file \"public/javascripts/rails.js\", /prototype/\n+ end\n+ \n+ def test_config_jquery_javascript_library\n+ run_generator [destination_root, \"-j\", \"jquery\"]\n+ assert_file \"config/application.rb\", /^\\s+config\\.action_view\\.javascript_expansions\\[:defaults\\]\\s+=\\s+%w\\(jquery rails\\)/\n+ assert_file \"public/javascripts/application.js\"\n+ assert_file \"public/javascripts/jquery.js\"\n+ assert_file \"public/javascripts/rails.js\", /jQuery/\n end\n \n def test_shebang_is_added_to_rails_file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:49 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 15:26:06 GMT",
etag = "\"34f42df892310dfeb7ebc0815d9ee365\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24815D:54D9023D",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "2811da37fbdda4367181b328b22b2499"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "3fa46d0f430fb33e20c88e6a4fc5cabf81e08d04", filename = "actionpack/lib/action_view/base.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/26991bb5508311a85fcc6fb469bf73924190ff5e/actionpack/lib/action_view/base.rb",
raw_url = "https://github.com/rails/rails/raw/26991bb5508311a85fcc6fb469bf73924190ff5e/actionpack/lib/action_view/base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_view/base.rb?ref=26991bb5508311a85fcc6fb469bf73924190ff5e",
patch = "@@ -153,7 +153,7 @@ module ActionView #:nodoc:\n #\n # This refreshes the sidebar, removes a person element and highlights the user list.\n #\n- # See the ActionView::Helpers::PrototypeHelper::GeneratorMethods documentation for more details.\n+ # See the ActionView::Helpers::PrototypeHelper::JavaScriptGenerator::GeneratorMethods documentation for more details.\n class Base\n module Subclasses\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "cd3a3eac802b37426c86121d5c414ea552d60213",
filename = "actionpack/lib/action_view/helpers/javascript_helper.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/26991bb5508311a85fcc6fb469bf73924190ff5e/actionpack/lib/action_view/helpers/javascript_helper.rb",
raw_url = "https://github.com/rails/rails/raw/26991bb5508311a85fcc6fb469bf73924190ff5e/actionpack/lib/action_view/helpers/javascript_helper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_view/helpers/javascript_helper.rb?ref=26991bb5508311a85fcc6fb469bf73924190ff5e",
patch = "@@ -65,7 +65,7 @@ def escape_javascript(javascript)\n # //]]>\n # </script>\n #\n- # +html_options+ may be a hash of attributes for the <tt><script></tt>\n+ # +html_options+ may be a hash of attributes for the <tt>\\<script></tt>\n # tag. Example:\n # javascript_tag \"alert('All is good')\", :defer => 'defer'\n # # => <script defer=\"defer\" type=\"text/javascript\">alert('All is good')</script>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "300207dfac52867bad5e3220e4850cafed87e550",
filename = "actionpack/lib/action_view/helpers/prototype_helper.rb",
status = "modified", additions = 4L, deletions = 4L, changes = 8L,
blob_url = "https://github.com/rails/rails/blob/26991bb5508311a85fcc6fb469bf73924190ff5e/actionpack/lib/action_view/helpers/prototype_helper.rb",
raw_url = "https://github.com/rails/rails/raw/26991bb5508311a85fcc6fb469bf73924190ff5e/actionpack/lib/action_view/helpers/prototype_helper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_view/helpers/prototype_helper.rb?ref=26991bb5508311a85fcc6fb469bf73924190ff5e",
patch = "@@ -161,7 +161,7 @@ def include_helpers_from_context\n \n # JavaScriptGenerator generates blocks of JavaScript code that allow you\n # to change the content and presentation of multiple DOM elements. Use\n- # this in your Ajax response bodies, either in a <tt><script></tt> tag\n+ # this in your Ajax response bodies, either in a <tt>\\<script></tt> tag\n # or as plain JavaScript sent with a Content-type of \"text/javascript\".\n #\n # Create new instances with PrototypeHelper#update_page or with\n@@ -224,7 +224,7 @@ def include_helpers_from_context\n #\n # You can also use PrototypeHelper#update_page_tag instead of\n # PrototypeHelper#update_page to wrap the generated JavaScript in a\n- # <tt><script></tt> tag.\n+ # <tt>\\<script></tt> tag.\n module GeneratorMethods\n def to_s #:nodoc:\n (@lines * $/).tap do |javascript|\n@@ -583,10 +583,10 @@ def update_page(&block)\n end\n \n # Works like update_page but wraps the generated JavaScript in a\n- # <tt><script></tt> tag. Use this to include generated JavaScript in an\n+ # <tt>\\<script></tt> tag. Use this to include generated JavaScript in an\n # ERb template. See JavaScriptGenerator for more information.\n #\n- # +html_options+ may be a hash of <tt><script></tt> attributes to be\n+ # +html_options+ may be a hash of <tt>\\<script></tt> attributes to be\n # passed to ActionView::Helpers::JavaScriptHelper#javascript_tag.\n def update_page_tag(html_options = {}, &block)\n javascript_tag update_page(&block), html_options"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "0168233fce8eebda82e512f6754b0174be75f7e5",
filename = "activemodel/lib/active_model/validator.rb", status = "modified",
additions = 2L, deletions = 2L, changes = 4L, blob_url = "https://github.com/rails/rails/blob/26991bb5508311a85fcc6fb469bf73924190ff5e/activemodel/lib/active_model/validator.rb",
raw_url = "https://github.com/rails/rails/raw/26991bb5508311a85fcc6fb469bf73924190ff5e/activemodel/lib/active_model/validator.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/lib/active_model/validator.rb?ref=26991bb5508311a85fcc6fb469bf73924190ff5e",
patch = "@@ -7,7 +7,7 @@ module ActiveModel #:nodoc:\n # == Active Model Validator\n #\n # A simple base class that can be used along with\n- # +ActiveModel::Validations::ClassMethods.validates_with+\n+ # ActiveModel::Validations::ClassMethods.validates_with\n #\n # class Person\n # include ActiveModel::Validations\n@@ -42,7 +42,7 @@ module ActiveModel #:nodoc:\n # end\n # end\n #\n- # To cause a validation error, you must add to the <tt>record<tt>'s errors directly\n+ # To cause a validation error, you must add to the <tt>record</tt>'s errors directly\n # from within the validators message\n #\n # class MyValidator < ActiveModel::Validator"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:49 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Thu, 05 Feb 2015 09:53:39 GMT",
etag = "\"8d50433e568129400307b982ad572718\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24817B:54D9023D",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "474556b853193c38f1b14328ce2d1b7d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "97363c8003c94cb8c6e9545d1e111df3df07d5c6", filename = "activerecord/lib/active_record/nested_attributes.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/f13a5674885f3d3388b5bc03a11c33f46866216b/activerecord/lib/active_record/nested_attributes.rb",
raw_url = "https://github.com/rails/rails/raw/f13a5674885f3d3388b5bc03a11c33f46866216b/activerecord/lib/active_record/nested_attributes.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/nested_attributes.rb?ref=f13a5674885f3d3388b5bc03a11c33f46866216b",
patch = "@@ -323,7 +323,7 @@ def assign_nested_attributes_for_one_to_one_association(association_name, attrib\n (options[:update_only] || record.id.to_s == attributes['id'].to_s)\n assign_to_or_mark_for_destruction(record, attributes, options[:allow_destroy])\n \n- elsif attributes['id']\n+ elsif not attributes['id'].blank?\n existing_record = self.class.reflect_on_association(association_name).klass.find(attributes['id'])\n assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy])\n self.send(association_name.to_s+'=', existing_record)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "7efd75e5cd7b0f3ade766012521b6dbe31b5b845",
filename = "activerecord/test/cases/nested_attributes_test.rb",
status = "modified", additions = 9L, deletions = 0L, changes = 9L,
blob_url = "https://github.com/rails/rails/blob/f13a5674885f3d3388b5bc03a11c33f46866216b/activerecord/test/cases/nested_attributes_test.rb",
raw_url = "https://github.com/rails/rails/raw/f13a5674885f3d3388b5bc03a11c33f46866216b/activerecord/test/cases/nested_attributes_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/nested_attributes_test.rb?ref=f13a5674885f3d3388b5bc03a11c33f46866216b",
patch = "@@ -114,6 +114,15 @@ def test_reject_if_with_indifferent_keys\n pirate.ship_attributes = { :name => 'Hello Pearl' }\n assert_difference('Ship.count') { pirate.save! }\n end\n+ \n+ def test_reject_if_with_blank_nested_attributes_id\n+ # When using a select list to choose an existing 'ship' id, with :include_blank => true\n+ Pirate.accepts_nested_attributes_for :ship, :reject_if => proc {|attributes| attributes[:id].blank? }\n+\n+ pirate = Pirate.new(:catchphrase => \"Stop wastin' me time\")\n+ pirate.ship_attributes = { :id => \"\" }\n+ assert_nothing_raised(ActiveRecord::RecordNotFound) { pirate.save! }\n+ end\n end\n \n class TestNestedAttributesOnAHasOneAssociation < ActiveRecord::TestCase"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:49 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 17:55:55 GMT",
etag = "\"197c397a18b1324c2f19e872e6b67aa2\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24819E:54D9023D",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "4c8b2d4732c413f4b9aefe394bd65569"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "d13e7f69e44a8f6b4d2a66a34b1a22cce9074416", filename = "actionpack/lib/action_view/helpers/cache_helper.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/8efd79d33be99e67fa40904e06e400877737704b/actionpack/lib/action_view/helpers/cache_helper.rb",
raw_url = "https://github.com/rails/rails/raw/8efd79d33be99e67fa40904e06e400877737704b/actionpack/lib/action_view/helpers/cache_helper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_view/helpers/cache_helper.rb?ref=8efd79d33be99e67fa40904e06e400877737704b",
patch = "@@ -46,8 +46,8 @@ def cache(name = {}, options = nil, &block)\n private\n # TODO: Create an object that has caching read/write on it\n def fragment_for(name = {}, options = nil, &block) #:nodoc:\n- if controller.fragment_exist?(name, options)\n- controller.read_fragment(name, options)\n+ if fragment = controller.read_fragment(name, options)\n+ fragment\n else\n # VIEW TODO: Make #capture usable outside of ERB\n # This dance is needed because Builder can't use capture"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "3c581719f80e63f2d16c8730eb3dff0fd3fbfbb7",
filename = "actionpack/test/controller/log_subscriber_test.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/8efd79d33be99e67fa40904e06e400877737704b/actionpack/test/controller/log_subscriber_test.rb",
raw_url = "https://github.com/rails/rails/raw/8efd79d33be99e67fa40904e06e400877737704b/actionpack/test/controller/log_subscriber_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/controller/log_subscriber_test.rb?ref=8efd79d33be99e67fa40904e06e400877737704b",
patch = "@@ -135,7 +135,7 @@ def test_with_fragment_cache\n wait\n \n assert_equal 4, logs.size\n- assert_match /Exist fragment\\? views\\/foo/, logs[1]\n+ assert_match /Read fragment views\\/foo/, logs[1]\n assert_match /Write fragment views\\/foo/, logs[2]\n ensure\n @controller.config.perform_caching = true"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:49 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 14:13:33 GMT",
etag = "\"dd791c266be9ea9c6b1791dc18c38524\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2481C3:54D9023D",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "dc1ce2bfb41810a06c705e83b388572d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "fc2abacb6d61ff4a65a043101a016124943d9122", filename = "activemodel/lib/active_model/naming.rb",
status = "modified", additions = 3L, deletions = 2L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/5a91f2e10fb7418371649046e1ac9343cb24a16a/activemodel/lib/active_model/naming.rb",
raw_url = "https://github.com/rails/rails/raw/5a91f2e10fb7418371649046e1ac9343cb24a16a/activemodel/lib/active_model/naming.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/lib/active_model/naming.rb?ref=5a91f2e10fb7418371649046e1ac9343cb24a16a",
patch = "@@ -1,4 +1,5 @@\n require 'active_support/inflector'\n+require 'active_support/core_ext/hash/except'\n \n module ActiveModel\n class Name < String\n@@ -35,10 +36,10 @@ def human(options={})\n klass.model_name.i18n_key\n end\n \n- defaults << options.delete(:default) if options[:default]\n+ defaults << options[:default] if options[:default]\n defaults << @human\n \n- options.reverse_merge! :scope => [@klass.i18n_scope, :models], :count => 1, :default => defaults\n+ options = {:scope => [@klass.i18n_scope, :models], :count => 1, :default => defaults}.merge(options.except(:default))\n I18n.translate(defaults.shift, options)\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "40ce4c0e2d0fb011406e435e2b9675b0bcd52ea8",
filename = "activemodel/test/cases/naming_test.rb", status = "modified",
additions = 4L, deletions = 0L, changes = 4L, blob_url = "https://github.com/rails/rails/blob/5a91f2e10fb7418371649046e1ac9343cb24a16a/activemodel/test/cases/naming_test.rb",
raw_url = "https://github.com/rails/rails/raw/5a91f2e10fb7418371649046e1ac9343cb24a16a/activemodel/test/cases/naming_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/test/cases/naming_test.rb?ref=5a91f2e10fb7418371649046e1ac9343cb24a16a",
patch = "@@ -28,6 +28,10 @@ def test_collection\n def test_partial_path\n assert_equal 'post/track_backs/track_back', @model_name.partial_path\n end\n+\n+ def test_human\n+ assert_equal 'Track back', @model_name.human\n+ end\n end\n \n class NamingWithNamespacedModelInIsolatedNamespaceTest < ActiveModel::TestCase"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ac2e56321eae532d866dfb257a8d35cebffa2d6d",
filename = "activemodel/test/cases/translation_test.rb",
status = "modified", additions = 6L, deletions = 0L, changes = 6L,
blob_url = "https://github.com/rails/rails/blob/5a91f2e10fb7418371649046e1ac9343cb24a16a/activemodel/test/cases/translation_test.rb",
raw_url = "https://github.com/rails/rails/raw/5a91f2e10fb7418371649046e1ac9343cb24a16a/activemodel/test/cases/translation_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/test/cases/translation_test.rb?ref=5a91f2e10fb7418371649046e1ac9343cb24a16a",
patch = "@@ -46,5 +46,11 @@ def test_translated_model_names_with_ancestors_fallback\n I18n.backend.store_translations 'en', :activemodel => {:models => {:person => 'person model'} }\n assert_equal 'person model', Child.model_name.human\n end\n+\n+ def test_human_does_not_modify_options\n+ options = {:default => 'person model'}\n+ Person.model_name.human(options)\n+ assert_equal({:default => 'person model'}, options)\n+ end\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:49 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 18:28:59 GMT",
etag = "\"21f6d4d31ca3162000eacf0ec6c5c1e2\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2481DE:54D9023D",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "318e55760cf7cdb40e61175a4d36cd32"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "0db83d1f6bc36c6a09ae5a1ef985632a040bb2a8", filename = "activeresource/lib/active_resource/associations.rb",
status = "added", additions = 233L, deletions = 0L, changes = 233L,
blob_url = "https://github.com/rails/rails/blob/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/lib/active_resource/associations.rb",
raw_url = "https://github.com/rails/rails/raw/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/lib/active_resource/associations.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/associations.rb?ref=eb5e3c32f7de136bedf08d571a8dce936541f60c",
patch = "@@ -0,0 +1,233 @@\n+require 'active_resource/associations/association_collection'\n+\n+module ActiveResource\n+ module Associations\n+\n+ # Active Resource Associations works in the same way than Active Record\n+ # associations, it follows the same coventions and method names.\n+ # At the moment it support only one-to-one and one-to-many associations,\n+ # many-to-many associations are not implemented yet.\n+ #\n+ # An example of use:\n+ #\n+ # class Project < ActiveRecord::Base\n+ # self.site = \"http://37s.sunrise.i:3000\"\n+ #\n+ # belongs_to :portfolio\n+ # has_one :project_manager\n+ # has_many :milestones\n+ # end\n+ #\n+ # The project class now has the following methods in order to manipulate the relationships:\n+ # * <tt>Project#portfolio, Project#portfolio=(portfolio), Project#portfolio.nil?</tt>\n+ # * <tt>Project#project_manager, Project#project_manager=(project_manager), Project#project_manager.nil?,</tt>\n+ # * <tt>Project#milestones.empty?, Project#milestones.size, Project#milestones, Project#milestones<<(milestone), Project#milestone.delete(milestone)</tt>\n+ #\n+ #\n+ # == Auto-generated methods\n+ #\n+ # === Singular associations (one-to-one)\n+ # | | belongs_to |\n+ # generated methods | belongs_to | :polymorphic | has_one\n+ # ----------------------------------+------------+--------------+---------\n+ # other | X | X | X\n+ # other=(other) | X | X | X\n+ #\n+ # ===Collection associations (one-to-many)\n+ #\n+ # generated methods (only one-to-many)\n+ # --------------------------\n+ # others\n+ # others=[other,other]\n+ # others<<\n+ # others.size\n+ # others.length\n+ # others.empty?\n+ # others.clear\n+ # others.delete(other)\n+ #\n+ # === One-to-one\n+ #\n+ # Use has_one in the base, and belongs_to in the associated model.\n+ #\n+ # class ProjectManager < ActiveResource::Base\n+ # self.site = \"http://37s.sunrise.i:3000\"\n+ # belongs_to :project\n+ # end\n+ #\n+ # class Project < ActiveResource::Base\n+ # self.site = \"http://37s.sunrise.i:3000\"\n+ # has_one :project_manager\n+ # end\n+ #\n+ # @project = Project.find(1)\n+ # @project.project_manager = ProjectManager.find(3)\n+ # @project.project_manager #=> #<ProjectManager:0x7fb91bb05708 @persisted=true,\n+ # @attributes={\"name\"=>\"David\", \"project_id\"=>1, \"id\"=>5}, @prefix_options={}>\n+ #\n+ #\n+ # === One-to-many\n+ #\n+ # Use has_many in the base, and belongs_to in the associated model.\n+ #\n+ # class Project < ActiveResource::Base\n+ # self.site = \"http://37s.sunrise.i:3000\"\n+ # has_many :milestones\n+ # end\n+ #\n+ # class Milestone < ActiveResource::Base\n+ # self.site = \"http://37s.sunrise.i:3000\"\n+ # end\n+ #\n+ # @milestone = Milestone.find(2)\n+ # @project = Project.find(1)\n+ # @project.milestones << @milestone\n+ #\n+ # This will set the @milestone.milestone_id to @project.id\n+ # and save @milestone, then when you call @project.milestones\n+ # will return an AssociationCollection list with the recently milestone added\n+ # included.\n+ #\n+ # @project.milestones #=>[#<Milestone:0x7f8b3134ac88 @persisted=true,\n+ # @attributes={\"title\"=>\"pre\", \"project_id\"=>nil, \"id\"=>1},\n+ # @prefix_options={}>, #<Milestone:0x7f8b31324768 @errors=#<OrderedHash {}>,\n+ # @validation_context=nil, @persisted=true, @attributes={\"title\"=>\"rc other\",\n+ # \"project_id\"=>nil, \"id\"=>2}, @remote_errors=nil, @prefix_options={}>]\n+ #\n+ #\n+ # === Collections\n+ #\n+ # * Adding an object to a collection (+has_many+) automatically saves that resource.\n+ #\n+ # === Cache\n+ #\n+ # * Every association set an instance variable over the base resource and works\n+ # with a simple cache that keep the result of the last fetched resource\n+ # unless you specifically instructed not to.\n+ #\n+ # project.milestones # fetches milestones resources\n+ # project.milestones.size # uses the milestone cache\n+ # project.milestones.empty? # uses the milestone cache\n+ # project.milestones(true).size # fetches milestones from the database\n+ # project.milestones # uses the milestone cache\n+ #\n+ def self.included(klass)\n+ klass.send :include, InstanceMethods\n+ klass.extend ClassMethods\n+ end\n+\n+ module InstanceMethods\n+ def set_resource_instance_variable(resource, force_reload = false)\n+ if !instance_variable_defined?(\"@#{resource}\") or force_reload\n+ instance_variable_set(\"@#{resource}\", yield)\n+ end\n+ instance_variable_get(\"@#{resource}\")\n+ end\n+ end\n+\n+ module ClassMethods\n+\n+ def options(association, resource)\n+ o = { :klass => klass_for(association, resource) }\n+ o[:host_klass] = self\n+\n+ case association\n+ when :has_many\n+ o[:association_col] = o[:host_klass].to_s.singularize\n+ when :belongs_to\n+ o[:association_col] = o[:klass]\n+ when :has_one\n+ o[:association_col] = o[:host_klass].to_s\n+ end\n+ o[:association_col] = \"#{o[:association_col].underscore}_id\".to_sym\n+ o\n+ end\n+\n+ def klass_for(association, resource)\n+ resource = resource.to_s\n+ resource = resource.singularize if association == :has_many\n+ resource.camelize\n+ end\n+\n+ def has_one(resource, opts = {})\n+ o = options(:has_one, resource)\n+\n+ # Define accessor method for resource\n+ #\n+ define_method(resource) do |*force_reload|\n+ force_reload = force_reload.first || false\n+\n+ set_resource_instance_variable(resource, force_reload) do\n+ o[:klass].constantize.find(:first, :params => { o[:association_col] => id })\n+ end\n+ end\n+\n+ # Define writter method for resource\n+ #\n+ define_method(\"#{resource}=\") do |new_resource|\n+ if send(resource).blank?\n+ new_resource.send(\"#{o[:association_col]}=\", id)\n+ instance_variable_set(\"@#{resource}\", new_resource.save)\n+ else\n+ instance_variable_get(\"@#{resource}\").send(:update_attribute, o[:association_col], id)\n+ end\n+ end\n+ end\n+\n+ def belongs_to(resource, opts = {})\n+ o = options(:belongs_to, resource)\n+\n+ # Define accessor method for resource\n+ #\n+ define_method(resource) do |*force_reload|\n+ force_reload = force_reload.first || false\n+\n+ association_col = send o[:association_col]\n+ return nil if association_col.nil?\n+ set_resource_instance_variable(resource, force_reload){\n+ o[:klass].constantize.find(association_col)\n+ }\n+ end\n+\n+ # Define writter method for resource\n+ #\n+ define_method(\"#{resource}=\") do |new_resource|\n+ if send(o[:association_col]) != new_resource.id\n+ send \"#{o[:association_col]}=\", new_resource.id\n+ end\n+ instance_variable_set(\"@#{resource}\", new_resource)\n+ end\n+ end\n+\n+ def has_many(resource, opts = {})\n+ o = options(:has_many, resource)\n+\n+ # Define accessor method for resource\n+ #\n+ define_method(resource) do |*force_reload|\n+ force_reload = force_reload.first || false\n+\n+ set_resource_instance_variable(resource, force_reload) {\n+ result = o[:klass].constantize.find(:all,\n+ :params => { o[:association_col] => id }) || []\n+\n+ AssociationCollection.new result, self, o[:association_col]\n+ }\n+ end\n+\n+ define_method(\"#{resource}=\") do |new_collection|\n+ collection = send(resource)\n+ to_remove = collection - new_collection\n+ to_remove.each{|m| collection.delete(m)}\n+\n+ # FIXME should call the old clear\n+ collection.clear\n+ # FIXME Is this needed?\n+ collection.concat new_collection\n+ end\n+ end\n+\n+ end\n+ end\n+\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "3795aa51f6b0e4a4e0feb16725a0ce072c1f97e7",
filename = "activeresource/lib/active_resource/associations/association_collection.rb",
status = "added", additions = 31L, deletions = 0L, changes = 31L,
blob_url = "https://github.com/rails/rails/blob/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/lib/active_resource/associations/association_collection.rb",
raw_url = "https://github.com/rails/rails/raw/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/lib/active_resource/associations/association_collection.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/associations/association_collection.rb?ref=eb5e3c32f7de136bedf08d571a8dce936541f60c",
patch = "@@ -0,0 +1,31 @@\n+module ActiveResource\n+ module Associations\n+\n+ class AssociationCollection < Array\n+\n+ def initialize(array, host_resource, association_col)\n+ @host_resource = host_resource\n+ @association_col = association_col\n+ self.concat array\n+ end\n+\n+ def <<(member)\n+ member.send \"#{@association_col}=\", @host_resource.id\n+ member.save\n+ super(member)\n+ end\n+\n+ def delete(member)\n+ member.send \"#{@association_col}=\", nil\n+ member.save\n+ super(member)\n+ end\n+\n+ def clear\n+ self.each{|member| delete(member)}\n+ super\n+ end\n+\n+ end\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "75e95dbdd2a15d0716f9501e35566621d6ec921d",
filename = "activeresource/lib/active_resource/base.rb",
status = "modified", additions = 2L, deletions = 1L, changes = 3L,
blob_url = "https://github.com/rails/rails/blob/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/lib/active_resource/base.rb",
raw_url = "https://github.com/rails/rails/raw/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/lib/active_resource/base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/base.rb?ref=eb5e3c32f7de136bedf08d571a8dce936541f60c",
patch = "@@ -18,6 +18,7 @@\n require 'active_resource/formats'\n require 'active_resource/schema'\n require 'active_resource/log_subscriber'\n+require 'active_resource/associations'\n \n module ActiveResource\n # ActiveResource::Base is the main class for mapping RESTful resources as models in a Rails application.\n@@ -262,7 +263,7 @@ class Base\n # :singleton-method:\n # The logger for diagnosing and tracing Active Resource calls.\n cattr_accessor :logger\n-\n+ include Associations\n class << self\n # Creates a schema for this resource - setting the attributes that are\n # known prior to fetching an instance from the remote system."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "17e9c5cfd4bf05d5514b1b3513b4ef1808814c5f",
filename = "activeresource/test/cases/associations_test.rb",
status = "added", additions = 144L, deletions = 0L, changes = 144L,
blob_url = "https://github.com/rails/rails/blob/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/test/cases/associations_test.rb",
raw_url = "https://github.com/rails/rails/raw/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/test/cases/associations_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/test/cases/associations_test.rb?ref=eb5e3c32f7de136bedf08d571a8dce936541f60c",
patch = "@@ -0,0 +1,144 @@\n+require 'abstract_unit'\n+require \"fixtures/project\"\n+\n+class ProjectManager < ActiveResource::Base\n+ self.site = \"http://37s.sunrise.i:3000\"\n+ belongs_to :project\n+end\n+\n+class Project < ActiveResource::Base\n+ self.site = \"http://37s.sunrise.i:3000\"\n+ has_one :project_manager\n+ has_many :milestones\n+end\n+\n+class Milestone < ActiveResource::Base\n+ self.site = \"http://37s.sunrise.i:3000\"\n+end\n+\n+@project = { :id => 1, :name => \"Rails\"}\n+@other_project = { :id => 2, :name => \"Ruby\"}\n+@project_manager = {:id => 5, :name => \"David\", :project_id =>1}\n+@other_project_manager = {:id => 6, :name => \"John\", :project_id => nil}\n+@project_managers = [@project_manager]\n+@milestone = { :id => 1, :title => \"pre\", :project_id => nil}\n+@other_milestone = { :id => 2, :title => \"rc other\", :project_id => nil}\n+\n+ActiveResource::HttpMock.respond_to do |mock|\n+ mock.get \"/projects/.xml\", {}, @project.to_xml(:root => 'project')\n+ mock.get \"/projects/1.xml\", {}, @project.to_xml(:root => 'project')\n+ mock.get \"/projects/2.xml\", {}, @other_project.to_xml(:root => 'project')\n+ mock.get \"/project_managers/5.xml\", {}, @project_manager.to_xml(:root => 'project_manager')\n+ mock.get \"/project_managers/6.xml\", {}, @other_project_manager.to_xml(:root => 'project_manager')\n+ mock.get \"/project_managers.xml?project_id=1\", {}, @project_managers.to_xml\n+ mock.get \"/project_managers.xml?project_id=2\", {}, [].to_xml\n+ mock.get \"/milestones.xml\", {}, [@milestone].to_xml\n+ mock.get \"/milestones.xml?project_id=2\", {}, [].to_xml\n+ mock.get \"/milestones.xml?project_id=1\", {}, [@milestone].to_xml\n+ mock.put \"/project_managers/6.xml\", {}, nil, 204\n+ mock.put \"/milestones/2.xml\", {}, nil, 204\n+ mock.put \"/milestones/1.xml\", {}, nil, 204\n+ mock.get \"/milestones/1.xml\", {}, @milestone.to_xml(:root => 'milestone')\n+ mock.get \"/milestones/2.xml\", {}, @other_milestone.to_xml(:root => 'milestone')\n+end\n+\n+class AssociationsTest < Test::Unit::TestCase\n+\n+ def setup\n+ @project = Project.find(1)\n+ @other_project = Project.find(2)\n+ @project_manager = ProjectManager.find(5)\n+ @other_project_manager = ProjectManager.find(6)\n+ @milestone = Milestone.find(1)\n+ @other_milestone = Milestone.find(2)\n+ end\n+\n+ #----------------------------------------------------------------------\n+ # has_one association\n+ #----------------------------------------------------------------------\n+\n+ def test_has_one_should_add_a_resource_accessor\n+ assert @project.respond_to? :project_manager\n+ end\n+\n+ def test_has_one_accessor_should_return_the_associated_project_manager\n+ assert_equal @project_manager, @project.project_manager\n+ end\n+\n+ def test_has_one_accessor_should_return_nil_when_the_does_not_has_an_associated_resource\n+ assert_nil @other_project.project_manager\n+ end\n+\n+ def test_has_one_should_assign_a_new_project_manager_when_it_does_not_has_a_project_manager\n+ @other_project.project_manager = @other_project_manager\n+ assert_equal @other_project.id, @other_project_manager.project_id\n+ end\n+\n+ #----------------------------------------------------------------------\n+ # belogns_to association\n+ #----------------------------------------------------------------------\n+\n+ def test_belongs_to_should_add_a_resource_accessor\n+ assert @project_manager.respond_to? :project\n+ end\n+\n+ def test_belongs_to_accessor_should_return_the_associated_project\n+ assert_equal @project, @project_manager.project\n+ end\n+\n+ def test_belongs_to_accessor_should_return_nil_when_the_does_not_has_an_associated_resource\n+ assert_nil @other_project_manager.project\n+ end\n+\n+ def test_has_one_should_assign_a_new_project_manager_when_it_does_not_has_a_project_manager\n+ @other_project_manager.project = @other_project\n+ assert_equal @other_project_manager.project_id, @other_project.id\n+ end\n+\n+ #----------------------------------------------------------------------\n+ # has_many association\n+ #----------------------------------------------------------------------\n+\n+ def test_has_many_should_add_a_resource_accessor\n+ assert @project.respond_to? :milestones\n+ end\n+\n+ def test_has_many_accessor_should_return_the_an_array_with_the_associated_milestones\n+ assert_equal [@milestone], @project.milestones\n+ end\n+\n+ def test_has_many_accessor_should_return_the_an_empty_array_when_it_does_not_has_milestones\n+ assert_equal [], @other_project.milestones\n+ end\n+\n+ def test_has_many_accessor_should_return_the_an_array_including_the_added_obj\n+ @project.milestones << @other_milestone\n+ assert_equal @other_milestone.project_id, @project.id\n+ end\n+\n+ def test_has_many_accessor_should_return_the_an_array_without_including_the_deleted_obj\n+ @project.milestones << @other_milestone\n+ @project.milestones.delete(@other_milestone)\n+ assert_nil @other_milestone.project_id\n+ end\n+\n+ def test_has_many_accessor_should_return_the_an_empty_array_after_clear\n+ @project.milestones << @other_milestone\n+ @project.milestones.clear\n+\n+ assert_equal [], @project.milestones\n+ end\n+\n+ def test_has_many_accessor_should_return_the_new_array_after_assign\n+ @project.milestones = [@other_milestone]\n+ assert_equal [@other_milestone], @project.milestones\n+\n+ @project.milestones = []\n+ assert_equal [], @project.milestones\n+\n+ @project.milestones = [@milestone, @other_milestone]\n+ assert_equal [@milestone, @other_milestone], @project.milestones\n+ end\n+\n+end\n+"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "a57139e2c7fb0ca24c75b2f4182927b97a75696a",
filename = "activeresource/test/fixtures/project.rb", status = "modified",
additions = 4L, deletions = 0L, changes = 4L, blob_url = "https://github.com/rails/rails/blob/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/test/fixtures/project.rb",
raw_url = "https://github.com/rails/rails/raw/eb5e3c32f7de136bedf08d571a8dce936541f60c/activeresource/test/fixtures/project.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/test/fixtures/project.rb?ref=eb5e3c32f7de136bedf08d571a8dce936541f60c",
patch = "@@ -2,6 +2,9 @@\n class Project < ActiveResource::Base\n self.site = \"http://37s.sunrise.i:3000\"\n \n+ #----------------------------------------------------------------------\n+ # validations\n+ #\n validates_presence_of :name\n validate :description_greater_than_three_letters\n \n@@ -18,6 +21,7 @@ def description_greater_than_three_letters\n def name\n attributes['name'] || nil\n end\n+\n def description\n attributes['description'] || nil\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:50 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Sat, 07 Feb 2015 22:15:47 GMT",
etag = "\"ffb145adc3f356a5ebbe502e30f6673e\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2481F6:54D9023D",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "a241e1a8264a6ace03db946c85b92db3"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "8379f6a66f22ffc620f64e3b07afa0b874e6569e", filename = "activerecord/lib/active_record.rb",
status = "modified", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -79,6 +79,7 @@ module ActiveRecord\n autoload :Timestamp\n autoload :Transactions\n autoload :Validations\n+ autoload :IdentityMap\n end\n \n module Coders"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "2eb431dfeca763e31bdca957dd1aa516985fab51",
filename = "activerecord/lib/active_record/associations/association.rb",
status = "modified", additions = 17L, deletions = 1L, changes = 18L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/associations/association.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/associations/association.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/associations/association.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -24,6 +24,7 @@ class Association #:nodoc:\n def initialize(owner, reflection)\n reflection.check_validity!\n \n+ @target = nil\n @owner, @reflection = owner, reflection\n @updated = false\n \n@@ -42,6 +43,7 @@ def aliased_table_name\n # Resets the \\loaded flag to +false+ and sets the \\target to +nil+.\n def reset\n @loaded = false\n+ IdentityMap.remove(@target) if IdentityMap.enabled? && @target\n @target = nil\n end\n \n@@ -141,7 +143,17 @@ def target_scope\n # ActiveRecord::RecordNotFound is rescued within the method, and it is\n # not reraised. The proxy is \\reset and +nil+ is the return value.\n def load_target\n- @target = find_target if find_target?\n+ if find_target?\n+ begin\n+ if IdentityMap.enabled? && association_class && association_class.respond_to?(:base_class)\n+ @target = IdentityMap.get(association_class, @owner[@reflection.foreign_key])\n+ end\n+ rescue NameError\n+ nil\n+ ensure\n+ @target ||= find_target\n+ end\n+ end\n loaded!\n target\n rescue ActiveRecord::RecordNotFound\n@@ -241,6 +253,10 @@ def invertible_for?(record)\n # This is only relevant to certain associations, which is why it returns nil by default.\n def stale_state\n end\n+\n+ def association_class\n+ @reflection.klass\n+ end\n end\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "b711ff35ca6a207ff8d945de6438fe90fc0788f0",
filename = "activerecord/lib/active_record/associations/class_methods/join_dependency.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/associations/class_methods/join_dependency.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/associations/class_methods/join_dependency.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/associations/class_methods/join_dependency.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -187,8 +187,8 @@ def construct(parent, associations, join_parts, row)\n construct(parent, association, join_parts, row)\n end\n when Hash\n- associations.sort_by { |k,_| k.to_s }.each do |name, assoc|\n- association = construct(parent, name, join_parts, row)\n+ associations.sort_by { |k,_| k.to_s }.each do |association_name, assoc|\n+ association = construct(parent, association_name, join_parts, row)\n construct(association, assoc, join_parts, row) if association\n end\n else"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "3eff3d54e31f8761b7c87feaa53b1aafc93a0c7a",
filename = "activerecord/lib/active_record/attribute_methods/dirty.rb",
status = "modified", additions = 5L, deletions = 0L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/attribute_methods/dirty.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/attribute_methods/dirty.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/attribute_methods/dirty.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -22,6 +22,8 @@ def save(*) #:nodoc:\n if status = super\n @previously_changed = changes\n @changed_attributes.clear\n+ elsif IdentityMap.enabled?\n+ IdentityMap.remove(self)\n end\n status\n end\n@@ -32,6 +34,9 @@ def save!(*) #:nodoc:\n @previously_changed = changes\n @changed_attributes.clear\n end\n+ rescue\n+ IdentityMap.remove(self) if IdentityMap.enabled?\n+ raise\n end\n \n # <tt>reload</tt> the record and clears changed attributes."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "476598bf88dff1a55bc7b086ff4cc12071bf90c9",
filename = "activerecord/lib/active_record/autosave_association.rb",
status = "modified", additions = 26L, deletions = 3L, changes = 29L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/autosave_association.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/autosave_association.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/autosave_association.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -140,6 +140,23 @@ def #{type}(name, options = {})\n CODE\n end\n \n+ def define_non_cyclic_method(name, reflection, &block)\n+ define_method(name) do |*args|\n+ result = true; @_already_called ||= {}\n+ # Loop prevention for validation of associations\n+ unless @_already_called[[name, reflection.name]]\n+ begin\n+ @_already_called[[name, reflection.name]]=true\n+ result = instance_eval(&block)\n+ ensure\n+ @_already_called[[name, reflection.name]]=false\n+ end\n+ end\n+\n+ result\n+ end\n+ end\n+\n # Adds validation and save callbacks for the association as specified by\n # the +reflection+.\n #\n@@ -160,7 +177,7 @@ def add_autosave_association_callbacks(reflection)\n if collection\n before_save :before_save_collection_association\n \n- define_method(save_method) { save_collection_association(reflection) }\n+ define_non_cyclic_method(save_method, reflection) { save_collection_association(reflection) }\n # Doesn't use after_save as that would save associations added in after_create/after_update twice\n after_create save_method\n after_update save_method\n@@ -178,7 +195,7 @@ def add_autosave_association_callbacks(reflection)\n after_create save_method\n after_update save_method\n else\n- define_method(save_method) { save_belongs_to_association(reflection) }\n+ define_non_cyclic_method(save_method, reflection) { save_belongs_to_association(reflection) }\n before_save save_method\n end\n end\n@@ -186,7 +203,7 @@ def add_autosave_association_callbacks(reflection)\n \n if reflection.validate? && !method_defined?(validation_method)\n method = (collection ? :validate_collection_association : :validate_single_association)\n- define_method(validation_method) { send(method, reflection) }\n+ define_non_cyclic_method(validation_method, reflection) { send(method, reflection) }\n validate validation_method\n end\n end\n@@ -303,6 +320,7 @@ def save_collection_association(reflection)\n autosave = reflection.options[:autosave]\n \n if records = associated_records_to_validate_or_save(association, @new_record_before_save, autosave)\n+ begin\n records.each do |record|\n next if record.destroyed?\n \n@@ -322,6 +340,11 @@ def save_collection_association(reflection)\n \n raise ActiveRecord::Rollback unless saved\n end\n+ rescue\n+ records.each {|x| IdentityMap.remove(x) } if IdentityMap.enabled?\n+ raise\n+ end\n+\n end\n \n # reconstruct the scope now that we know the owner's id"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "01f5f4eccd276b0c257f66e16cfc784545ad9cea",
filename = "activerecord/lib/active_record/base.rb", status = "modified",
additions = 26L, deletions = 4L, changes = 30L, blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/base.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/base.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -819,6 +819,10 @@ def ===(object)\n object.is_a?(self)\n end\n \n+ def symbolized_base_class\n+ @symbolized_base_class ||= base_class.to_s.to_sym\n+ end\n+\n # Returns the base AR subclass that this class descends from. If A\n # extends AR::Base, A.base_class will return A. If B descends from A\n # through some arbitrarily deep hierarchy, B.base_class will return A.\n@@ -913,10 +917,25 @@ def _load(data)\n # Finder methods must instantiate through this method to work with the\n # single-table inheritance model that makes it possible to create\n # objects of different types from the same table.\n- def instantiate(record) # :nodoc:\n- model = find_sti_class(record[inheritance_column]).allocate\n- model.init_with('attributes' => record)\n- model\n+ def instantiate(record)\n+ sti_class = find_sti_class(record[inheritance_column])\n+ record_id = sti_class.primary_key && record[sti_class.primary_key]\n+\n+ if ActiveRecord::IdentityMap.enabled? && record_id\n+ if (column = sti_class.columns_hash[sti_class.primary_key]) && column.number?\n+ record_id = record_id.to_i\n+ end\n+ if instance = IdentityMap.get(sti_class, record_id)\n+ instance.reinit_with('attributes' => record)\n+ else\n+ instance = sti_class.allocate.init_with('attributes' => record)\n+ IdentityMap.add(instance)\n+ end\n+ else\n+ instance = sti_class.allocate.init_with('attributes' => record)\n+ end\n+\n+ instance\n end\n \n private\n@@ -1467,6 +1486,8 @@ def init_with(coder)\n @new_record = false\n run_callbacks :find\n run_callbacks :initialize\n+\n+ self\n end\n \n # Specifies how the record is dumped by +Marshal+.\n@@ -1933,6 +1954,7 @@ def clear_timestamp_attributes\n include ActiveModel::MassAssignmentSecurity\n include Callbacks, ActiveModel::Observing, Timestamp\n include Associations, AssociationPreload, NamedScope\n+ include IdentityMap\n include ActiveModel::SecurePassword\n \n # AutosaveAssociation needs to be included before Transactions, because we want"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "7839f038488247c9f8fdce5dcde12c42c1c70c26",
filename = "activerecord/lib/active_record/counter_cache.rb",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/counter_cache.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/counter_cache.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/counter_cache.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -74,6 +74,8 @@ def update_counters(id, counters)\n \"#{quoted_column} = COALESCE(#{quoted_column}, 0) #{operator} #{value.abs}\"\n end\n \n+ IdentityMap.remove_by_id(symbolized_base_class, id) if IdentityMap.enabled?\n+\n update_all(updates.join(', '), primary_key => id )\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d523c643ba250d15db0dfdc9dc86c467dc630f16",
filename = "activerecord/lib/active_record/fixtures.rb",
status = "modified", additions = 3L, deletions = 1L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/fixtures.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/fixtures.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/fixtures.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -887,7 +887,9 @@ def setup_fixture_accessors(fixture_names = nil)\n @fixture_cache[fixture_name].delete(fixture) if force_reload\n \n if @loaded_fixtures[fixture_name][fixture.to_s]\n- @fixture_cache[fixture_name][fixture] ||= @loaded_fixtures[fixture_name][fixture.to_s].find\n+ ActiveRecord::IdentityMap.without do\n+ @fixture_cache[fixture_name][fixture] ||= @loaded_fixtures[fixture_name][fixture.to_s].find\n+ end\n else\n raise StandardError, \"No fixture with name '#{fixture}' found for table '#{fixture_name}'\"\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d18b2b0a5413c730d31f9bd9b520a17652d6d39d",
filename = "activerecord/lib/active_record/identity_map.rb",
status = "added", additions = 102L, deletions = 0L, changes = 102L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/identity_map.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/identity_map.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/identity_map.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -0,0 +1,102 @@\n+module ActiveRecord\n+ # = Active Record Identity Map\n+ #\n+ # Ensures that each object gets loaded only once by keeping every loaded\n+ # object in a map. Looks up objects using the map when referring to them.\n+ #\n+ # More information on Identity Map pattern:\n+ # http://www.martinfowler.com/eaaCatalog/identityMap.html\n+ #\n+ # == Configuration\n+ #\n+ # In order to enable IdentityMap, set <tt>config.active_record.identity_map = true</tt>\n+ # in your <tt>config/application.rb</tt> file.\n+ #\n+ # IdentityMap is disabled by default.\n+ #\n+ module IdentityMap\n+ extend ActiveSupport::Concern\n+\n+ class << self\n+ def enabled=(flag)\n+ Thread.current[:identity_map_enabled] = flag\n+ end\n+\n+ def enabled\n+ Thread.current[:identity_map_enabled]\n+ end\n+ alias enabled? enabled\n+\n+ def repository\n+ Thread.current[:identity_map] ||= Hash.new { |h,k| h[k] = {} }\n+ end\n+\n+ def use\n+ old, self.enabled = enabled, true\n+\n+ yield if block_given?\n+ ensure\n+ self.enabled = old\n+ clear\n+ end\n+\n+ def without\n+ old, self.enabled = enabled, false\n+\n+ yield if block_given?\n+ ensure\n+ self.enabled = old\n+ end\n+\n+ def get(klass, primary_key)\n+ obj = repository[klass.symbolized_base_class][primary_key]\n+ obj.is_a?(klass) ? obj : nil\n+ end\n+\n+ def add(record)\n+ repository[record.class.symbolized_base_class][record.id] = record\n+ end\n+\n+ def remove(record)\n+ repository[record.class.symbolized_base_class].delete(record.id)\n+ end\n+\n+ def remove_by_id(symbolized_base_class, id)\n+ repository[symbolized_base_class].delete(id)\n+ end\n+\n+ def clear\n+ repository.clear\n+ end\n+ end\n+\n+ # Reinitialize an Identity Map model object from +coder+.\n+ # +coder+ must contain the attributes necessary for initializing an empty\n+ # model object.\n+ def reinit_with(coder)\n+ @attributes_cache = {}\n+ dirty = @changed_attributes.keys\n+ @attributes.update(coder['attributes'].except(*dirty))\n+ @changed_attributes.update(coder['attributes'].slice(*dirty))\n+ @changed_attributes.delete_if{|k,v| v.eql? @attributes[k]}\n+\n+ set_serialized_attributes\n+\n+ run_callbacks :find\n+\n+ self\n+ end\n+\n+ class Middleware\n+ def initialize(app)\n+ @app = app\n+ end\n+\n+ def call(env)\n+ ActiveRecord::IdentityMap.use do\n+ @app.call(env)\n+ end\n+ end\n+ end\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "522c0cfc9f14ce950a55602a643d2cd72d13b00e",
filename = "activerecord/lib/active_record/nested_attributes.rb",
status = "modified", additions = 10L, deletions = 3L, changes = 13L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/nested_attributes.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/nested_attributes.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/nested_attributes.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -403,7 +403,12 @@ def assign_nested_attributes_for_collection_association(association_name, attrib\n unless reject_new_record?(association_name, attributes)\n association.build(attributes.except(*UNASSIGNABLE_KEYS))\n end\n-\n+ elsif existing_records.count == 0 #Existing record but not yet associated\n+ existing_record = self.class.reflect_on_association(association_name).klass.find(attributes['id'])\n+ if !call_reject_if(association_name, attributes)\n+ association.send(:add_record_to_target_with_callbacks, existing_record) if !association.loaded?\n+ assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy])\n+ end\n elsif existing_record = existing_records.detect { |record| record.id.to_s == attributes['id'].to_s }\n unless association.loaded? || call_reject_if(association_name, attributes)\n # Make sure we are operating on the actual object which is in the association's\n@@ -415,10 +420,12 @@ def assign_nested_attributes_for_collection_association(association_name, attrib\n else\n association.add_to_target(existing_record)\n end\n- end\n \n- assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy])\n+ end\n \n+ if !call_reject_if(association_name, attributes)\n+ assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy])\n+ end\n else\n raise_nested_attributes_record_not_found(association_name, attributes['id'])\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "df7b22080c879cb4419bc5e1d72bd2f14f095d33",
filename = "activerecord/lib/active_record/persistence.rb",
status = "modified", additions = 12L, deletions = 2L, changes = 14L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/persistence.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/persistence.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/persistence.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -64,7 +64,10 @@ def save!(*)\n # callbacks, Observer methods, or any <tt>:dependent</tt> association\n # options, use <tt>#destroy</tt>.\n def delete\n- self.class.delete(id) if persisted?\n+ if persisted?\n+ self.class.delete(id)\n+ IdentityMap.remove(self) if IdentityMap.enabled?\n+ end\n @destroyed = true\n freeze\n end\n@@ -73,6 +76,7 @@ def delete\n # that no changes should be made (since they can't be persisted).\n def destroy\n if persisted?\n+ IdentityMap.remove(self) if IdentityMap.enabled?\n self.class.unscoped.where(self.class.arel_table[self.class.primary_key].eq(id)).delete_all\n end\n \n@@ -196,7 +200,12 @@ def toggle!(attribute)\n def reload(options = nil)\n clear_aggregation_cache\n clear_association_cache\n- @attributes.update(self.class.unscoped { self.class.find(self.id, options) }.instance_variable_get('@attributes'))\n+\n+ IdentityMap.without do\n+ fresh_object = self.class.unscoped { self.class.find(self.id, options) }\n+ @attributes.update(fresh_object.instance_variable_get('@attributes'))\n+ end\n+\n @attributes_cache = {}\n self\n end\n@@ -275,6 +284,7 @@ def create\n \n self.id ||= new_id\n \n+ IdentityMap.add(self) if IdentityMap.enabled?\n @new_record = false\n id\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "cace6f0cc02b7c0f6e3938c60bc8a6f7e27cd65f",
filename = "activerecord/lib/active_record/railtie.rb", status = "modified",
additions = 5L, deletions = 0L, changes = 5L, blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/railtie.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/railtie.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/railtie.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -43,6 +43,11 @@ class Railtie < Rails::Railtie\n ActiveSupport.on_load(:active_record) { self.logger ||= ::Rails.logger }\n end\n \n+ initializer \"active_record.identity_map\" do |app|\n+ config.app_middleware.insert_after \"::ActionDispatch::Callbacks\",\n+ \"ActiveRecord::IdentityMap::Middleware\" if config.active_record.delete(:identity_map)\n+ end\n+\n initializer \"active_record.set_configs\" do |app|\n ActiveSupport.on_load(:active_record) do\n app.config.active_record.each do |k,v|"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "cb684c1109537b7d8a01db7bb6f4d11171284c84",
filename = "activerecord/lib/active_record/relation.rb",
status = "modified", additions = 7L, deletions = 1L, changes = 8L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/relation.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/relation.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/relation.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -81,7 +81,13 @@ def respond_to?(method, include_private = false)\n def to_a\n return @records if loaded?\n \n- @records = eager_loading? ? find_with_associations : @klass.find_by_sql(arel.to_sql, @bind_values)\n+ @records = if @readonly_value.nil? && !@klass.locking_enabled?\n+ eager_loading? ? find_with_associations : @klass.find_by_sql(arel.to_sql, @bind_values)\n+ else\n+ IdentityMap.without do\n+ eager_loading? ? find_with_associations : @klass.find_by_sql(arel.to_sql, @bind_values)\n+ end\n+ end\n \n preload = @preload_values\n preload += @includes_values unless eager_loading?"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "4e711c4884a07450f1f68890a13832dafb4986ab",
filename = "activerecord/lib/active_record/test_case.rb",
status = "modified", additions = 10L, deletions = 0L, changes = 10L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/test_case.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/test_case.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/test_case.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -3,6 +3,16 @@ module ActiveRecord\n #\n # Defines some test assertions to test against SQL queries.\n class TestCase < ActiveSupport::TestCase #:nodoc:\n+ setup :cleanup_identity_map\n+\n+ def setup\n+ cleanup_identity_map\n+ end\n+\n+ def cleanup_identity_map\n+ ActiveRecord::IdentityMap.clear\n+ end\n+\n def assert_date_from_db(expected, actual, message = nil)\n # SybaseAdapter doesn't have a separate column type just for dates,\n # so the time is in the string and incorrectly formatted"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "60d4c256c4ae3c9ce26e93f757bd70cff68825f6",
filename = "activerecord/lib/active_record/transactions.rb",
status = "modified", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/transactions.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/lib/active_record/transactions.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/transactions.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -251,6 +251,7 @@ def rollback_active_record_state!\n remember_transaction_record_state\n yield\n rescue Exception\n+ IdentityMap.remove(self) if IdentityMap.enabled?\n restore_transaction_record_state\n raise\n ensure"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "eb3f8143e7da73d16101f35942c60bff42f4f322",
filename = "activerecord/test/cases/adapters/mysql/connection_test.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/adapters/mysql/connection_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/adapters/mysql/connection_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/adapters/mysql/connection_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -102,7 +102,7 @@ def test_exec_typecasts_bind_vals\n end\n \n # Test that MySQL allows multiple results for stored procedures\n- if Mysql.const_defined?(:CLIENT_MULTI_RESULTS)\n+ if defined?(Mysql) && Mysql.const_defined?(:CLIENT_MULTI_RESULTS)\n def test_multi_results\n rows = ActiveRecord::Base.connection.select_rows('CALL ten();')\n assert_equal 10, rows[0][0].to_i, \"ten() did not return 10 as expected: #{rows.inspect}\""), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d75791cab98c18182c07fd4b3955259693780a4f",
filename = "activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb",
status = "modified", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -27,6 +27,7 @@ def test_class_names\n post = Namespaced::Post.find_by_title( 'Great stuff', :include => :tagging )\n assert_nil post.tagging\n \n+ ActiveRecord::IdentityMap.clear\n ActiveRecord::Base.store_full_sti_class = true\n post = Namespaced::Post.find_by_title( 'Great stuff', :include => :tagging )\n assert_instance_of Tagging, post.tagging"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ca71cd8ed3a7abe796aeff404d3d56470d15392c",
filename = "activerecord/test/cases/associations/eager_test.rb",
status = "modified", additions = 7L, deletions = 7L, changes = 14L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/eager_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/eager_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/associations/eager_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -185,7 +185,7 @@ def test_finding_with_includes_on_has_one_assocation_with_same_include_includes_\n author = authors(:david)\n post = author.post_about_thinking_with_last_comment\n last_comment = post.last_comment\n- author = assert_queries(3) { Author.find(author.id, :include => {:post_about_thinking_with_last_comment => :last_comment})} # find the author, then find the posts, then find the comments\n+ author = assert_queries(ActiveRecord::IdentityMap.enabled? ? 2 : 3) { Author.find(author.id, :include => {:post_about_thinking_with_last_comment => :last_comment})} # find the author, then find the posts, then find the comments\n assert_no_queries do\n assert_equal post, author.post_about_thinking_with_last_comment\n assert_equal last_comment, author.post_about_thinking_with_last_comment.last_comment\n@@ -196,7 +196,7 @@ def test_finding_with_includes_on_belongs_to_association_with_same_include_inclu\n post = posts(:welcome)\n author = post.author\n author_address = author.author_address\n- post = assert_queries(3) { Post.find(post.id, :include => {:author_with_address => :author_address}) } # find the post, then find the author, then find the address\n+ post = assert_queries(ActiveRecord::IdentityMap.enabled? ? 2 : 3) { Post.find(post.id, :include => {:author_with_address => :author_address}) } # find the post, then find the author, then find the address\n assert_no_queries do\n assert_equal author, post.author_with_address\n assert_equal author_address, post.author_with_address.author_address\n@@ -817,18 +817,18 @@ def test_eager_loading_with_conditions_on_joined_table_preloads\n assert_equal [posts(:welcome)], posts\n assert_equal authors(:david), assert_no_queries { posts[0].author}\n \n- posts = assert_queries(2) do\n+ posts = assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do\n Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [:comments], :conditions => \"comments.body like 'Thank you%'\", :order => 'posts.id')\n end\n assert_equal [posts(:welcome)], posts\n assert_equal authors(:david), assert_no_queries { posts[0].author}\n \n- posts = assert_queries(2) do\n+ posts = assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do\n Post.find(:all, :include => :author, :joins => {:taggings => :tag}, :conditions => \"tags.name = 'General'\", :order => 'posts.id')\n end\n assert_equal posts(:welcome, :thinking), posts\n \n- posts = assert_queries(2) do\n+ posts = assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do\n Post.find(:all, :include => :author, :joins => {:taggings => {:tag => :taggings}}, :conditions => \"taggings_tags.super_tag_id=2\", :order => 'posts.id')\n end\n assert_equal posts(:welcome, :thinking), posts\n@@ -842,7 +842,7 @@ def test_eager_loading_with_conditions_on_string_joined_table_preloads\n assert_equal [posts(:welcome)], posts\n assert_equal authors(:david), assert_no_queries { posts[0].author}\n \n- posts = assert_queries(2) do\n+ posts = assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do\n Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [\"INNER JOIN comments on comments.post_id = posts.id\"], :conditions => \"comments.body like 'Thank you%'\", :order => 'posts.id')\n end\n assert_equal [posts(:welcome)], posts\n@@ -931,7 +931,7 @@ def test_preloading_empty_belongs_to\n def test_preloading_empty_belongs_to_polymorphic\n t = Tagging.create!(:taggable_type => 'Post', :taggable_id => Post.maximum(:id) + 1, :tag => tags(:general))\n \n- tagging = assert_queries(2) { Tagging.preload(:taggable).find(t.id) }\n+ tagging = assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) { Tagging.preload(:taggable).find(t.id) }\n assert_no_queries { assert_nil tagging.taggable }\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "bfc5ddc74783e8d77ab5367aa035e66b63eda5a9",
filename = "activerecord/test/cases/associations/has_one_through_associations_test.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/has_one_through_associations_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/has_one_through_associations_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/associations/has_one_through_associations_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -88,12 +88,12 @@ def test_has_one_through_with_conditions_eager_loading\n # conditions on the through table\n assert_equal clubs(:moustache_club), Member.find(@member.id, :include => :favourite_club).favourite_club\n memberships(:membership_of_favourite_club).update_attribute(:favourite, false)\n- assert_equal nil, Member.find(@member.id, :include => :favourite_club).favourite_club\n+ assert_equal nil, Member.find(@member.id, :include => :favourite_club).reload.favourite_club\n \n # conditions on the source table\n assert_equal clubs(:moustache_club), Member.find(@member.id, :include => :hairy_club).hairy_club\n clubs(:moustache_club).update_attribute(:name, \"Association of Clean-Shaven Persons\")\n- assert_equal nil, Member.find(@member.id, :include => :hairy_club).hairy_club\n+ assert_equal nil, Member.find(@member.id, :include => :hairy_club).reload.hairy_club\n end\n \n def test_has_one_through_polymorphic_with_source_type"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "9b8635774c1ec53591653d0f80d226972ab7c7d2",
filename = "activerecord/test/cases/associations/identity_map_test.rb",
status = "added", additions = 137L, deletions = 0L, changes = 137L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/identity_map_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/identity_map_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/associations/identity_map_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -0,0 +1,137 @@\n+require \"cases/helper\"\n+require 'models/author'\n+require 'models/post'\n+\n+if ActiveRecord::IdentityMap.enabled?\n+class InverseHasManyIdentityMapTest < ActiveRecord::TestCase\n+ fixtures :authors, :posts\n+\n+ def test_parent_instance_should_be_shared_with_every_child_on_find\n+ m = Author.first\n+ is = m.posts\n+ is.each do |i|\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to child-owned instance\"\n+ end\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_eager_loaded_children\n+ m = Author.find(:first, :include => :posts)\n+ is = m.posts\n+ is.each do |i|\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to child-owned instance\"\n+ end\n+\n+ m = Author.find(:first, :include => :posts, :order => 'posts.id')\n+ is = m.posts\n+ is.each do |i|\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to child-owned instance\"\n+ end\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_newly_built_child\n+ m = Author.first\n+ i = m.posts.build(:title => 'Industrial Revolution Re-enactment', :body => 'Lorem ipsum')\n+ assert_not_nil i.author\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to just-built-child-owned instance\"\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_newly_block_style_built_child\n+ m = Author.first\n+ i = m.posts.build {|ii| ii.title = 'Industrial Revolution Re-enactment'; ii.body = 'Lorem ipsum'}\n+ assert_not_nil i.title, \"Child attributes supplied to build via blocks should be populated\"\n+ assert_not_nil i.author\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to just-built-child-owned instance\"\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_newly_created_child\n+ m = Author.first\n+ i = m.posts.create(:title => 'Industrial Revolution Re-enactment', :body => 'Lorem ipsum')\n+ assert_not_nil i.author\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to newly-created-child-owned instance\"\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_newly_created_via_bang_method_child\n+ m = Author.first\n+ i = m.posts.create!(:title => 'Industrial Revolution Re-enactment', :body => 'Lorem ipsum')\n+ assert_not_nil i.author\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to newly-created-child-owned instance\"\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_newly_block_style_created_child\n+ m = Author.first\n+ i = m.posts.create {|ii| ii.title = 'Industrial Revolution Re-enactment'; ii.body = 'Lorem ipsum'}\n+ assert_not_nil i.title, \"Child attributes supplied to create via blocks should be populated\"\n+ assert_not_nil i.author\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to newly-created-child-owned instance\"\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_poked_in_child\n+ m = Author.first\n+ i = Post.create(:title => 'Industrial Revolution Re-enactment', :body => 'Lorem ipsum')\n+ m.posts << i\n+ assert_not_nil i.author\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to newly-created-child-owned instance\"\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_replaced_via_accessor_children\n+ m = Author.first\n+ i = Post.new(:title => 'Industrial Revolution Re-enactment', :body => 'Lorem ipsum')\n+ m.posts = [i]\n+ assert_same m, i.author\n+ assert_not_nil i.author\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to replaced-child-owned instance\"\n+ end\n+\n+ def test_parent_instance_should_be_shared_with_replaced_via_method_children\n+ m = Author.first\n+ i = Post.new(:title => 'Industrial Revolution Re-enactment', :body => 'Lorem ipsum')\n+ m.posts = [i]\n+ assert_not_nil i.author\n+ assert_equal m.name, i.author.name, \"Name of man should be the same before changes to parent instance\"\n+ m.name = 'Bongo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to parent instance\"\n+ i.author.name = 'Mungo'\n+ assert_equal m.name, i.author.name, \"Name of man should be the same after changes to replaced-child-owned instance\"\n+ end\n+end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "6d7f905dc548059d849548a78a9c4d4ced78a215",
filename = "activerecord/test/cases/associations/join_model_test.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/join_model_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/associations/join_model_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/associations/join_model_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -88,7 +88,7 @@ def test_polymorphic_has_many_going_through_join_model_with_include_on_source_re\n \n def test_polymorphic_has_many_going_through_join_model_with_custom_select_and_joins\n assert_equal tags(:general), tag = posts(:welcome).tags.add_joins_and_select.first\n- tag.author_id\n+ assert_nothing_raised(NoMethodError) { tag.author_id }\n end\n \n def test_polymorphic_has_many_going_through_join_model_with_custom_foreign_key"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ca59b3d6de7fcab9fe608c4b22558324d4078118",
filename = "activerecord/test/cases/autosave_association_test.rb",
status = "modified", additions = 3L, deletions = 2L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/autosave_association_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/autosave_association_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/autosave_association_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -585,7 +585,7 @@ def test_a_marked_for_destruction_record_should_not_be_be_marked_after_reload\n @pirate.ship.mark_for_destruction\n \n assert !@pirate.reload.marked_for_destruction?\n- assert !@pirate.ship.marked_for_destruction?\n+ assert !@pirate.ship.reload.marked_for_destruction?\n end\n \n # has_one\n@@ -1311,6 +1311,7 @@ class TestAutosaveAssociationValidationsOnAHasOneAssociation < ActiveRecord::Tes\n def setup\n @pirate = Pirate.create(:catchphrase => \"Don' botharrr talkin' like one, savvy?\")\n @pirate.create_ship(:name => 'titanic')\n+ super\n end\n \n test \"should automatically validate associations with :validate => true\" do\n@@ -1319,7 +1320,7 @@ def setup\n assert !@pirate.valid?\n end\n \n- test \"should not automatically validate associations without :validate => true\" do\n+ test \"should not automatically asd validate associations without :validate => true\" do\n assert @pirate.valid?\n @pirate.non_validated_ship.name = ''\n assert @pirate.valid?"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "fd20f1b120b8db1adba7e2f26449e845b331d42f",
filename = "activerecord/test/cases/helper.rb", status = "modified",
additions = 11L, deletions = 1L, changes = 12L, blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/helper.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/helper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/helper.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -11,7 +11,14 @@\n \n require 'active_record'\n require 'active_support/dependencies'\n-require 'connection'\n+begin\n+ require 'connection'\n+rescue LoadError\n+ # If we cannot load connection we assume that driver was not loaded for this test case, so we load sqlite3 as default one.\n+ # This allows for running separate test cases by simply running test file.\n+ connection_type = defined?(JRUBY_VERSION) ? 'jdbc' : 'native'\n+ require \"test/connections/#{connection_type}_sqlite3/connection\"\n+end\n \n # Show backtraces for deprecated behavior for quicker cleanup.\n ActiveSupport::Deprecation.debug = true\n@@ -19,6 +26,9 @@\n # Quote \"type\" if it's a reserved word for the current connection.\n QUOTED_TYPE = ActiveRecord::Base.connection.quote_column_name('type')\n \n+# Enable Identity Map for testing\n+ActiveRecord::IdentityMap.enabled = (ENV['IM'] == \"false\" ? false : true)\n+\n def current_adapter?(*types)\n types.any? do |type|\n ActiveRecord::ConnectionAdapters.const_defined?(type) &&"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d98638ab7306d82cbc68cfe5db283dafbacdd443",
filename = "activerecord/test/cases/identity_map_test.rb",
status = "added", additions = 402L, deletions = 0L, changes = 402L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/identity_map_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/identity_map_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/identity_map_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -0,0 +1,402 @@\n+require \"cases/helper\"\n+require 'models/developer'\n+require 'models/project'\n+require 'models/company'\n+require 'models/topic'\n+require 'models/reply'\n+require 'models/computer'\n+require 'models/customer'\n+require 'models/order'\n+require 'models/post'\n+require 'models/author'\n+require 'models/tag'\n+require 'models/tagging'\n+require 'models/comment'\n+require 'models/sponsor'\n+require 'models/member'\n+require 'models/essay'\n+require 'models/subscriber'\n+require \"models/pirate\"\n+require \"models/bird\"\n+require \"models/parrot\"\n+\n+if ActiveRecord::IdentityMap.enabled?\n+class IdentityMapTest < ActiveRecord::TestCase\n+ fixtures :accounts, :companies, :developers, :projects, :topics,\n+ :developers_projects, :computers, :authors, :author_addresses,\n+ :posts, :tags, :taggings, :comments, :subscribers\n+\n+ ##############################################################################\n+ # Basic tests checking if IM is functioning properly on basic find operations#\n+ ##############################################################################\n+\n+ def test_find_id\n+ assert_same(Client.find(3), Client.find(3))\n+ end\n+\n+ def test_find_id_without_identity_map\n+ ActiveRecord::IdentityMap.without do\n+ assert_not_same(Client.find(3), Client.find(3))\n+ end\n+ end\n+\n+ def test_find_id_use_identity_map\n+ ActiveRecord::IdentityMap.enabled = false\n+ ActiveRecord::IdentityMap.use do\n+ assert_same(Client.find(3), Client.find(3))\n+ end\n+ ActiveRecord::IdentityMap.enabled = true\n+ end\n+\n+ def test_find_pkey\n+ assert_same(\n+ Subscriber.find('swistak'),\n+ Subscriber.find('swistak')\n+ )\n+ end\n+\n+ def test_find_by_id\n+ assert_same(\n+ Client.find_by_id(3),\n+ Client.find_by_id(3)\n+ )\n+ end\n+\n+ def test_find_by_string_and_numeric_id\n+ assert_same(\n+ Client.find_by_id(\"3\"),\n+ Client.find_by_id(3)\n+ )\n+ end\n+\n+ def test_find_by_pkey\n+ assert_same(\n+ Subscriber.find_by_nick('swistak'),\n+ Subscriber.find_by_nick('swistak')\n+ )\n+ end\n+\n+ def test_find_first_id\n+ assert_same(\n+ Client.find(:first, :conditions => {:id => 1}),\n+ Client.find(:first, :conditions => {:id => 1})\n+ )\n+ end\n+\n+ def test_find_first_pkey\n+ assert_same(\n+ Subscriber.find(:first, :conditions => {:nick => 'swistak'}),\n+ Subscriber.find(:first, :conditions => {:nick => 'swistak'})\n+ )\n+ end\n+\n+ ##############################################################################\n+ # Tests checking if IM is functioning properly on more advanced finds #\n+ # and associations #\n+ ##############################################################################\n+\n+ def test_owner_object_is_associated_from_identity_map\n+ post = Post.find(1)\n+ comment = post.comments.first\n+\n+ assert_no_queries do\n+ comment.post\n+ end\n+ assert_same post, comment.post\n+ end\n+\n+ def test_associated_object_are_assigned_from_identity_map\n+ post = Post.find(1)\n+\n+ post.comments.each do |comment|\n+ assert_same post, comment.post\n+ assert_equal post.object_id, comment.post.object_id\n+ end\n+ end\n+\n+ def test_creation\n+ t1 = Topic.create(\"title\" => \"t1\")\n+ t2 = Topic.find(t1.id)\n+ assert_same(t1, t2)\n+ end\n+\n+ ##############################################################################\n+ # Tests checking dirty attribute behaviour with IM #\n+ ##############################################################################\n+\n+ def test_loading_new_instance_should_not_update_dirty_attributes\n+ swistak = Subscriber.find(:first, :conditions => {:nick => 'swistak'})\n+ swistak.name = \"Swistak Sreberkowiec\"\n+ assert_equal([\"name\"], swistak.changed)\n+ assert_equal({\"name\" => [\"Marcin Raczkowski\", \"Swistak Sreberkowiec\"]}, swistak.changes)\n+\n+ s = Subscriber.find('swistak')\n+\n+ assert swistak.name_changed?\n+ assert_equal(\"Swistak Sreberkowiec\", swistak.name)\n+ end\n+\n+ def test_loading_new_instance_should_change_dirty_attribute_original_value\n+ swistak = Subscriber.find(:first, :conditions => {:nick => 'swistak'})\n+ swistak.name = \"Swistak Sreberkowiec\"\n+\n+ Subscriber.update_all({:name => \"Raczkowski Marcin\"}, {:name => \"Marcin Raczkowski\"})\n+\n+ s = Subscriber.find('swistak')\n+\n+ assert_equal({'name' => [\"Raczkowski Marcin\", \"Swistak Sreberkowiec\"]}, swistak.changes)\n+ assert_equal(\"Swistak Sreberkowiec\", swistak.name)\n+ end\n+\n+ def test_loading_new_instance_should_remove_dirt\n+ swistak = Subscriber.find(:first, :conditions => {:nick => 'swistak'})\n+ swistak.name = \"Swistak Sreberkowiec\"\n+\n+ assert_equal({\"name\" => [\"Marcin Raczkowski\", \"Swistak Sreberkowiec\"]}, swistak.changes)\n+\n+ Subscriber.update_all({:name => \"Swistak Sreberkowiec\"}, {:name => \"Marcin Raczkowski\"})\n+\n+ s = Subscriber.find('swistak')\n+\n+ assert_equal(\"Swistak Sreberkowiec\", swistak.name)\n+ assert_equal({}, swistak.changes)\n+ assert !swistak.name_changed?\n+ end\n+\n+ def test_has_many_associations\n+ pirate = Pirate.create!(:catchphrase => \"Don' botharrr talkin' like one, savvy?\")\n+ pirate.birds.create!(:name => 'Posideons Killer')\n+ pirate.birds.create!(:name => 'Killer bandita Dionne')\n+\n+ posideons, killer = pirate.birds\n+\n+ pirate.reload\n+\n+ pirate.birds_attributes = [{ :id => posideons.id, :name => 'Grace OMalley' }]\n+ assert_equal 'Grace OMalley', pirate.birds.to_a.find { |r| r.id == posideons.id }.name\n+ end\n+\n+ def test_changing_associations\n+ post1 = Post.create(\"title\" => \"One post\", \"body\" => \"Posting...\")\n+ post2 = Post.create(\"title\" => \"Another post\", \"body\" => \"Posting... Again...\")\n+ comment = Comment.new(\"body\" => \"comment\")\n+\n+ comment.post = post1\n+ assert comment.save\n+\n+ assert_same(post1.comments.first, comment)\n+\n+ comment.post = post2\n+ assert comment.save\n+\n+ assert_same(post2.comments.first, comment)\n+ assert_equal(0, post1.comments.size)\n+ end\n+\n+ def test_im_with_polymorphic_has_many_going_through_join_model_with_custom_select_and_joins\n+ tag = posts(:welcome).tags.first\n+ tag_with_joins_and_select = posts(:welcome).tags.add_joins_and_select.first\n+ assert_same(tag, tag_with_joins_and_select)\n+ assert_nothing_raised(NoMethodError, \"Joins/select was not loaded\") { tag.author_id }\n+ end\n+\n+ ##############################################################################\n+ # Tests checking Identity Map behaviour with preloaded associations, joins, #\n+ # includes etc. #\n+ ##############################################################################\n+\n+ def test_find_with_preloaded_associations\n+ assert_queries(2) do\n+ posts = Post.preload(:comments)\n+ assert posts.first.comments.first\n+ end\n+\n+ # With IM we'll retrieve post object from previous query, it'll have comments\n+ # already preloaded from first call\n+ assert_queries(1) do\n+ posts = Post.preload(:comments).to_a\n+ assert posts.first.comments.first\n+ end\n+\n+ assert_queries(2) do\n+ posts = Post.preload(:author)\n+ assert posts.first.author\n+ end\n+\n+ # With IM we'll retrieve post object from previous query, it'll have comments\n+ # already preloaded from first call\n+ assert_queries(1) do\n+ posts = Post.preload(:author).to_a\n+ assert posts.first.author\n+ end\n+\n+ assert_queries(1) do\n+ posts = Post.preload(:author, :comments).to_a\n+ assert posts.first.author\n+ assert posts.first.comments.first\n+ end\n+ end\n+\n+ def test_find_with_included_associations\n+ assert_queries(2) do\n+ posts = Post.includes(:comments)\n+ assert posts.first.comments.first\n+ end\n+\n+ assert_queries(1) do\n+ posts = Post.scoped.includes(:comments)\n+ assert posts.first.comments.first\n+ end\n+\n+ assert_queries(2) do\n+ posts = Post.includes(:author)\n+ assert posts.first.author\n+ end\n+\n+ assert_queries(1) do\n+ posts = Post.includes(:author, :comments).to_a\n+ assert posts.first.author\n+ assert posts.first.comments.first\n+ end\n+ end\n+\n+ def test_eager_loading_with_conditions_on_joined_table_preloads\n+ posts = Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [:comments], :conditions => \"comments.body like 'Thank you%'\", :order => 'posts.id')\n+ assert_equal [posts(:welcome)], posts\n+ assert_equal authors(:david), assert_no_queries { posts[0].author}\n+ assert_same posts.first.author, Author.first\n+\n+ posts = Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [:comments], :conditions => \"comments.body like 'Thank you%'\", :order => 'posts.id')\n+ assert_equal [posts(:welcome)], posts\n+ assert_equal authors(:david), assert_no_queries { posts[0].author}\n+ assert_same posts.first.author, Author.first\n+\n+ posts = Post.find(:all, :include => :author, :joins => {:taggings => :tag}, :conditions => \"tags.name = 'General'\", :order => 'posts.id')\n+ assert_equal posts(:welcome, :thinking), posts\n+ assert_same posts.first.author, Author.first\n+\n+ posts = Post.find(:all, :include => :author, :joins => {:taggings => {:tag => :taggings}}, :conditions => \"taggings_tags.super_tag_id=2\", :order => 'posts.id')\n+ assert_equal posts(:welcome, :thinking), posts\n+ assert_same posts.first.author, Author.first\n+ end\n+\n+ def test_eager_loading_with_conditions_on_string_joined_table_preloads\n+ posts = assert_queries(2) do\n+ Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => \"INNER JOIN comments on comments.post_id = posts.id\", :conditions => \"comments.body like 'Thank you%'\", :order => 'posts.id')\n+ end\n+ assert_equal [posts(:welcome)], posts\n+ assert_equal authors(:david), assert_no_queries { posts[0].author}\n+\n+ posts = assert_queries(1) do\n+ Post.find(:all, :select => 'distinct posts.*', :include => :author, :joins => [\"INNER JOIN comments on comments.post_id = posts.id\"], :conditions => \"comments.body like 'Thank you%'\", :order => 'posts.id')\n+ end\n+ assert_equal [posts(:welcome)], posts\n+ assert_equal authors(:david), assert_no_queries { posts[0].author}\n+ end\n+\n+ ##############################################################################\n+ # Behaviour releated to saving failures\n+ ##############################################################################\n+\n+ def test_reload_object_if_save_failed\n+ developer = Developer.first\n+ developer.salary = 0\n+\n+ assert !developer.save\n+\n+ same_developer = Developer.first\n+\n+ assert_not_same developer, same_developer\n+ assert_not_equal 0, same_developer.salary\n+ assert_not_equal developer.salary, same_developer.salary\n+ end\n+\n+ def test_reload_object_if_forced_save_failed\n+ developer = Developer.first\n+ developer.salary = 0\n+\n+ assert_raise(ActiveRecord::RecordInvalid) { developer.save! }\n+\n+ same_developer = Developer.first\n+\n+ assert_not_same developer, same_developer\n+ assert_not_equal 0, same_developer.salary\n+ assert_not_equal developer.salary, same_developer.salary\n+ end\n+\n+ def test_reload_object_if_update_attributes_fails\n+ developer = Developer.first\n+ developer.salary = 0\n+\n+ assert !developer.update_attributes(:salary => 0)\n+\n+ same_developer = Developer.first\n+\n+ assert_not_same developer, same_developer\n+ assert_not_equal 0, same_developer.salary\n+ assert_not_equal developer.salary, same_developer.salary\n+ end\n+\n+ ##############################################################################\n+ # Behaviour of readonly, forzen, destroyed\n+ ##############################################################################\n+\n+ def test_find_using_identity_map_respects_readonly_when_loading_associated_object_first\n+ author = Author.first\n+ readonly_comment = author.readonly_comments.first\n+\n+ comment = Comment.first\n+ assert !comment.readonly?\n+\n+ assert readonly_comment.readonly?\n+\n+ assert_raise(ActiveRecord::ReadOnlyRecord) {readonly_comment.save}\n+ assert comment.save\n+ end\n+\n+ def test_find_using_identity_map_respects_readonly\n+ comment = Comment.first\n+ assert !comment.readonly?\n+\n+ author = Author.first\n+ readonly_comment = author.readonly_comments.first\n+\n+ assert readonly_comment.readonly?\n+\n+ assert_raise(ActiveRecord::ReadOnlyRecord) {readonly_comment.save}\n+ assert comment.save\n+ end\n+\n+ def test_find_using_select_and_identity_map\n+ author_id, author = Author.select('id').first, Author.first\n+\n+ assert_equal author_id, author\n+ assert_same author_id, author\n+ assert_not_nil author.name\n+\n+ post, post_id = Post.first, Post.select('id').first\n+\n+ assert_equal post_id, post\n+ assert_same post_id, post\n+ assert_not_nil post.title\n+ end\n+\n+# Currently AR is not allowing changing primary key (see Persistence#update)\n+# So we ignore it. If this changes, this test needs to be uncommented.\n+# def test_updating_of_pkey\n+# assert client = Client.find(3),\n+# client.update_attribute(:id, 666)\n+#\n+# assert Client.find(666)\n+# assert_same(client, Client.find(666))\n+#\n+# s = Subscriber.find_by_nick('swistak')\n+# assert s.update_attribute(:nick, 'swistakTheJester')\n+# assert_equal('swistakTheJester', s.nick)\n+#\n+# assert stj = Subscriber.find_by_nick('swistakTheJester')\n+# assert_same(s, stj)\n+# end\n+\n+end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "37bbb17e747d5fce9ac0ad7db583c4c578293364",
filename = "activerecord/test/cases/relations_test.rb", status = "modified",
additions = 9L, deletions = 7L, changes = 16L, blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/relations_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/cases/relations_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/relations_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -285,7 +285,7 @@ def test_find_with_preloaded_associations\n assert posts.first.comments.first\n end\n \n- assert_queries(2) do\n+ assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do\n posts = Post.preload(:comments).to_a\n assert posts.first.comments.first\n end\n@@ -295,12 +295,12 @@ def test_find_with_preloaded_associations\n assert posts.first.author\n end\n \n- assert_queries(2) do\n+ assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do\n posts = Post.preload(:author).to_a\n assert posts.first.author\n end\n \n- assert_queries(3) do\n+ assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 3) do\n posts = Post.preload(:author, :comments).to_a\n assert posts.first.author\n assert posts.first.comments.first\n@@ -313,7 +313,7 @@ def test_find_with_included_associations\n assert posts.first.comments.first\n end\n \n- assert_queries(2) do\n+ assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 2) do\n posts = Post.scoped.includes(:comments)\n assert posts.first.comments.first\n end\n@@ -323,7 +323,7 @@ def test_find_with_included_associations\n assert posts.first.author\n end\n \n- assert_queries(3) do\n+ assert_queries(ActiveRecord::IdentityMap.enabled? ? 1 : 3) do\n posts = Post.includes(:author, :comments).to_a\n assert posts.first.author\n assert posts.first.comments.first\n@@ -603,8 +603,10 @@ def test_relation_merging_with_locks\n end\n \n def test_relation_merging_with_preload\n- [Post.scoped.merge(Post.preload(:author)), Post.preload(:author).merge(Post.scoped)].each do |posts|\n- assert_queries(2) { assert posts.first.author }\n+ ActiveRecord::IdentityMap.without do\n+ [Post.scoped.merge(Post.preload(:author)), Post.preload(:author).merge(Post.scoped)].each do |posts|\n+ assert_queries(2) { assert posts.first.author }\n+ end\n end\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c6a8c2fa240f08135f12dec045b0d7d36cb36a62",
filename = "activerecord/test/fixtures/subscribers.yml",
status = "modified", additions = 4L, deletions = 0L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/fixtures/subscribers.yml",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/activerecord/test/fixtures/subscribers.yml",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/fixtures/subscribers.yml?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -5,3 +5,7 @@ first:\n second:\n nick: webster132\n name: David Heinemeier Hansson\n+\n+thrid:\n+ nick: swistak\n+ name: Marcin Raczkowski\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "b7f64af3395d199511f1a6a62cb1b6b0b138e73d",
filename = "railties/lib/rails/generators/rails/app/templates/config/application.rb",
status = "modified", additions = 5L, deletions = 0L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/lib/rails/generators/rails/app/templates/config/application.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/lib/rails/generators/rails/app/templates/config/application.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/config/application.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -57,5 +57,10 @@ class Application < Rails::Application\n \n # Configure sensitive parameters which will be filtered from the log file.\n config.filter_parameters += [:password]\n+\n+<% unless options[:skip_active_record] -%>\n+ # Enable IdentityMap for Active Record, to disable set to false or remove the line below.\n+ config.active_record.identity_map = true\n+<% end -%>\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "00029e627e32dfe0cb20a6ad6c77c7b4e559b846",
filename = "railties/lib/rails/test_help.rb", status = "modified",
additions = 4L, deletions = 0L, changes = 4L, blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/lib/rails/test_help.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/lib/rails/test_help.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/test_help.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -19,6 +19,10 @@\n class ActiveSupport::TestCase\n include ActiveRecord::TestFixtures\n self.fixture_path = \"#{Rails.root}/test/fixtures/\"\n+\n+ setup do\n+ ActiveRecord::IdentityMap.clear\n+ end\n end\n \n ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "19311a7fa0fdd422ae11d77a07ab2256f96c89a3",
filename = "railties/test/application/initializers/frameworks_test.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/test/application/initializers/frameworks_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/test/application/initializers/frameworks_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/application/initializers/frameworks_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -1,7 +1,7 @@\n require \"isolation/abstract_unit\"\n \n module ApplicationTests\n- class FrameworlsTest < Test::Unit::TestCase\n+ class FrameworksTest < Test::Unit::TestCase\n include ActiveSupport::Testing::Isolation\n \n def setup\n@@ -166,7 +166,7 @@ def from_bar_helper\n \n require \"#{app_path}/config/environment\"\n \n- expects = [ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActiveRecord::SessionStore]\n+ expects = [ActiveRecord::IdentityMap::Middleware, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActiveRecord::SessionStore]\n middleware = Rails.application.config.middleware.map { |m| m.klass }\n assert_equal expects, middleware & expects\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d88bd05a74eac831ac77e1bf220c01865514f981",
filename = "railties/test/application/middleware_test.rb",
status = "modified", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/test/application/middleware_test.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/test/application/middleware_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/application/middleware_test.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -29,6 +29,7 @@ def app\n \"Rack::Sendfile\",\n \"ActionDispatch::Reloader\",\n \"ActionDispatch::Callbacks\",\n+ \"ActiveRecord::IdentityMap::Middleware\",\n \"ActiveRecord::ConnectionAdapters::ConnectionManagement\",\n \"ActiveRecord::QueryCache\",\n \"ActionDispatch::Cookies\",\n@@ -56,6 +57,7 @@ def app\n boot!\n assert !middleware.include?(\"ActiveRecord::ConnectionAdapters::ConnectionManagement\")\n assert !middleware.include?(\"ActiveRecord::QueryCache\")\n+ assert !middleware.include?(\"ActiveRecord::IdentityMap::Middleware\")\n end\n \n test \"removes lock if allow concurrency is set\" do\n@@ -112,6 +114,11 @@ def app\n assert_equal \"Rack::Runtime\", middleware.fourth\n end\n \n+ test \"identity map is inserted\" do\n+ boot!\n+ assert_equal \"ActiveRecord::IdentityMap::Middleware\", middleware[9]\n+ end\n+\n test \"insert middleware before\" do\n add_to_config \"config.middleware.insert_before ActionDispatch::Static, Rack::Config\"\n boot!"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c5b1cb9a8044e54db8aad3d01fc98ba8028731e5",
filename = "railties/test/isolation/abstract_unit.rb", status = "modified",
additions = 8L, deletions = 0L, changes = 8L, blob_url = "https://github.com/rails/rails/blob/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/test/isolation/abstract_unit.rb",
raw_url = "https://github.com/rails/rails/raw/00418ac96bf5a25d3a7cf760499ec19ad3700007/railties/test/isolation/abstract_unit.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/isolation/abstract_unit.rb?ref=00418ac96bf5a25d3a7cf760499ec19ad3700007",
patch = "@@ -215,6 +215,13 @@ def add_to_config(str)\n end\n end\n \n+ def remove_from_config(str)\n+ file = \"#{app_path}/config/application.rb\"\n+ contents = File.read(file)\n+ contents.sub!(/#{str}/, \"\")\n+ File.open(file, \"w+\") { |f| f.puts contents }\n+ end\n+\n def app_file(path, contents)\n FileUtils.mkdir_p File.dirname(\"#{app_path}/#{path}\")\n File.open(\"#{app_path}/#{path}\", 'w') do |f|\n@@ -231,6 +238,7 @@ def use_frameworks(arr)\n :activemodel,\n :activerecord,\n :activeresource] - arr\n+ remove_from_config \"config.active_record.identity_map = true\" if to_remove.include? :activerecord\n $:.reject! {|path| path =~ %r'/(#{to_remove.join('|')})/' }\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:50 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Thu, 05 Feb 2015 21:27:09 GMT",
etag = "\"125fc950f6f43ba07e21e56cb9456618\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248218:54D9023E",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "b0ef53392caa42315c6206737946d931"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "a9d64cd0478b5462a73f51e573954003b7eea656", filename = "actionpack/lib/action_dispatch/http/cache.rb",
status = "modified", additions = 18L, deletions = 24L, changes = 42L,
blob_url = "https://github.com/rails/rails/blob/a4c88e369d0d0e0185df4bf370ceb31539bb4a82/actionpack/lib/action_dispatch/http/cache.rb",
raw_url = "https://github.com/rails/rails/raw/a4c88e369d0d0e0185df4bf370ceb31539bb4a82/actionpack/lib/action_dispatch/http/cache.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_dispatch/http/cache.rb?ref=a4c88e369d0d0e0185df4bf370ceb31539bb4a82",
patch = "@@ -43,16 +43,11 @@ module Response\n \n def initialize(*)\n status, header, body = super\n-\n- @cache_control = {}\n- @etag = self[\"ETag\"]\n-\n- if cache_control = self[\"Cache-Control\"]\n- cache_control.split(/,\\s*/).each do |segment|\n- first, last = segment.split(\"=\")\n- @cache_control[first.to_sym] = last || true\n- end\n- end\n+ \n+ self[\"Cache-Control\"].split(/,\\s*/).each do |segment|\n+ first, last = segment.split(\"=\")\n+ cache_control[first.to_sym] = last || true\n+ end if self[\"Cache-Control\"]\n end\n \n def last_modified\n@@ -70,22 +65,23 @@ def last_modified=(utc_time)\n end\n \n def etag\n- @etag\n- end\n-\n- def etag?\n- @etag\n+ @etag ||= self[\"ETag\"]\n end\n+ alias_method :etag?, :etag\n \n def etag=(etag)\n key = ActiveSupport::Cache.expand_cache_key(etag)\n @etag = self[\"ETag\"] = %(\"#{Digest::MD5.hexdigest(key)}\")\n end\n+ \n+ def cache_control\n+ @cache_control ||= {}\n+ end\n \n private\n \n def handle_conditional_get!\n- if etag? || last_modified? || !@cache_control.empty?\n+ if etag? || last_modified? || !cache_control.empty?\n set_conditional_cache_control!\n end\n end\n@@ -95,20 +91,18 @@ def handle_conditional_get!\n def set_conditional_cache_control!\n return if self[\"Cache-Control\"].present?\n \n- control = @cache_control\n-\n- if control.empty?\n+ if cache_control.empty?\n headers[\"Cache-Control\"] = DEFAULT_CACHE_CONTROL\n- elsif @cache_control[:no_cache]\n+ elsif cache_control[:no_cache]\n headers[\"Cache-Control\"] = \"no-cache\"\n else\n- extras = control[:extras]\n- max_age = control[:max_age]\n+ extras = cache_control[:extras]\n+ max_age = cache_control[:max_age]\n \n options = []\n options << \"max-age=#{max_age.to_i}\" if max_age\n- options << (control[:public] ? \"public\" : \"private\")\n- options << \"must-revalidate\" if control[:must_revalidate]\n+ options << (cache_control[:public] ? \"public\" : \"private\")\n+ options << \"must-revalidate\" if cache_control[:must_revalidate]\n options.concat(extras) if extras\n \n headers[\"Cache-Control\"] = options.join(\", \")"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:50 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 17:44:50 GMT",
etag = "\"254223848cdeb97763cacd05ce94f3fe\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248236:54D9023E",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "a30e6f9aa7cf5731b87dfb3b9992202d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "dfe255ad7cc7f812e24148bcee5620a61362fd71", filename = "activerecord/lib/active_record/railtie.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/activerecord/lib/active_record/railtie.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/activerecord/lib/active_record/railtie.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/railtie.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -14,7 +14,7 @@ class Railtie < Rails::Railtie\n config.active_record = ActiveSupport::OrderedOptions.new\n \n config.app_generators.orm :active_record, :migration => true,\n- :timestamps => true\n+ :timestamps => true\n \n config.app_middleware.insert_after \"::ActionDispatch::Callbacks\",\n \"ActiveRecord::QueryCache\""), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "fd1cda991e169d88b18b67bb09f92ed8baf39e7c",
filename = "activesupport/lib/active_support/core_ext/hash.rb",
status = "modified", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/activesupport/lib/active_support/core_ext/hash.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/activesupport/lib/active_support/core_ext/hash.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/lib/active_support/core_ext/hash.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,5 +1,6 @@\n require 'active_support/core_ext/hash/conversions'\n require 'active_support/core_ext/hash/deep_merge'\n+require 'active_support/core_ext/hash/deep_dup'\n require 'active_support/core_ext/hash/diff'\n require 'active_support/core_ext/hash/except'\n require 'active_support/core_ext/hash/indifferent_access'"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "447142605c7d80df6e2d747d2d2de4f3fdb836c5",
filename = "activesupport/lib/active_support/core_ext/hash/deep_dup.rb",
status = "added", additions = 11L, deletions = 0L, changes = 11L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/activesupport/lib/active_support/core_ext/hash/deep_dup.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/activesupport/lib/active_support/core_ext/hash/deep_dup.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/lib/active_support/core_ext/hash/deep_dup.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,11 @@\n+class Hash\n+ # Returns a deep copy of hash.\n+ def deep_dup\n+ duplicate = self.dup\n+ duplicate.each_pair do |k,v|\n+ tv = duplicate[k]\n+ duplicate[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? tv.deep_dup : v\n+ end\n+ duplicate\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "bfcfddad47d2d8a6960d4abd9a24b727c37d1240",
filename = "activesupport/test/core_ext/hash_ext_test.rb",
status = "modified", additions = 15L, deletions = 0L, changes = 15L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/activesupport/test/core_ext/hash_ext_test.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/activesupport/test/core_ext/hash_ext_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/test/core_ext/hash_ext_test.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -316,6 +316,21 @@ def test_deep_merge_on_indifferent_access\n assert_equal expected, hash_1\n end\n \n+ def test_deep_dup\n+ hash = { :a => { :b => 'b' } }\n+ dup = hash.deep_dup\n+ dup[:a][:c] = 'c'\n+ assert_equal nil, hash[:a][:c]\n+ assert_equal 'c', dup[:a][:c]\n+ end\n+\n+ def test_deep_dup_initialize\n+ zero_hash = Hash.new 0\n+ hash = { :a => zero_hash }\n+ dup = hash.deep_dup\n+ assert_equal 0, dup[:a][44]\n+ end\n+\n def test_store_on_indifferent_access\n hash = HashWithIndifferentAccess.new\n hash.store(:test1, 1)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c8d70d8ffa43c568181885ca77b9ccaacc22d8e7",
filename = "railties/lib/rails/cli.rb", status = "modified",
additions = 6L, deletions = 1L, changes = 7L, blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/cli.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/cli.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/cli.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -11,4 +11,9 @@\n require 'rails/ruby_version_check'\n Signal.trap(\"INT\") { puts; exit }\n \n-require 'rails/commands/application'\n+if ARGV.first == 'plugin'\n+ ARGV.shift\n+ require 'rails/commands/plugin_new'\n+else\n+ require 'rails/commands/application'\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "00a7e30902e1a2162bfcb9fe379d0c5ef96b7232",
filename = "railties/lib/rails/commands/plugin_new.rb", status = "added",
additions = 16L, deletions = 0L, changes = 16L, blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/commands/plugin_new.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/commands/plugin_new.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/commands/plugin_new.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,16 @@\n+require 'rails/version'\n+if %w(--version -v).include? ARGV.first\n+ puts \"Rails #{Rails::VERSION::STRING}\"\n+ exit(0)\n+end\n+\n+if ARGV.first != \"new\"\n+ ARGV[0] = \"--help\"\n+else\n+ ARGV.shift\n+end\n+\n+require 'rails/generators'\n+require 'rails/generators/rails/plugin_new/plugin_new_generator'\n+\n+Rails::Generators::PluginNewGenerator.start"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "66fab0a760e1830cdb1572086ecaadbc6b10e2b3",
filename = "railties/lib/rails/configuration.rb", status = "modified",
additions = 8L, deletions = 0L, changes = 8L, blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/configuration.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/configuration.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/configuration.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,5 +1,6 @@\n require 'active_support/deprecation'\n require 'active_support/ordered_options'\n+require 'active_support/core_ext/hash/deep_dup'\n require 'rails/paths'\n require 'rails/rack'\n \n@@ -51,6 +52,13 @@ def initialize\n @colorize_logging = true\n end\n \n+ def initialize_copy(source)\n+ @aliases = @aliases.deep_dup\n+ @options = @options.deep_dup\n+ @fallbacks = @fallbacks.deep_dup\n+ @templates = @templates.dup\n+ end\n+\n def method_missing(method, *args)\n method = method.to_s.sub(/=$/, '').to_sym\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "4f458b0aeeff6f3b276d91e7bff15d1fe5ab1831",
filename = "railties/lib/rails/engine/configuration.rb",
status = "modified", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/engine/configuration.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/engine/configuration.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/engine/configuration.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -10,6 +10,7 @@ class Configuration < ::Rails::Railtie::Configuration\n def initialize(root=nil)\n super()\n @root = root\n+ @generators = app_generators.dup\n end\n \n # Returns the middleware stack for the engine."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "f5c626553c6eddd736f9cf7fc2570c1ae0bed8d0",
filename = "railties/lib/rails/generators/app_base.rb", status = "added",
additions = 176L, deletions = 0L, changes = 176L, blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/app_base.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/app_base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/app_base.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,176 @@\n+require 'digest/md5'\n+require 'active_support/secure_random'\n+require 'rails/version' unless defined?(Rails::VERSION)\n+require 'rbconfig'\n+require 'open-uri'\n+require 'uri'\n+\n+module Rails\n+ module Generators\n+ class AppBase < Base\n+ DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db )\n+ JAVASCRIPTS = %w( prototype jquery )\n+\n+ attr_accessor :rails_template\n+ add_shebang_option!\n+\n+ argument :app_path, :type => :string\n+\n+ def self.add_shared_options_for(name)\n+ class_option :builder, :type => :string, :aliases => \"-b\",\n+ :desc => \"Path to a #{name} builder (can be a filesystem path or URL)\"\n+\n+ class_option :template, :type => :string, :aliases => \"-m\",\n+ :desc => \"Path to an #{name} template (can be a filesystem path or URL)\"\n+\n+ class_option :skip_gemfile, :type => :boolean, :default => false,\n+ :desc => \"Don't create a Gemfile\"\n+\n+ class_option :skip_git, :type => :boolean, :aliases => \"-G\", :default => false,\n+ :desc => \"Skip Git ignores and keeps\"\n+\n+ class_option :skip_active_record, :type => :boolean, :aliases => \"-O\", :default => false,\n+ :desc => \"Skip Active Record files\"\n+\n+ class_option :database, :type => :string, :aliases => \"-d\", :default => \"sqlite3\",\n+ :desc => \"Preconfigure for selected database (options: #{DATABASES.join('/')})\"\n+\n+ class_option :javascript, :type => :string, :aliases => \"-j\", :default => \"prototype\",\n+ :desc => \"Preconfigure for selected javascript library (options: #{JAVASCRIPTS.join('/')})\"\n+\n+ class_option :skip_javascript, :type => :boolean, :aliases => \"-J\", :default => false,\n+ :desc => \"Skip javascript files\"\n+\n+ class_option :dev, :type => :boolean, :default => false,\n+ :desc => \"Setup the #{name} with Gemfile pointing to your Rails checkout\"\n+\n+ class_option :edge, :type => :boolean, :default => false,\n+ :desc => \"Setup the #{name} with Gemfile pointing to Rails repository\"\n+\n+ class_option :skip_test_unit, :type => :boolean, :aliases => \"-T\", :default => false,\n+ :desc => \"Skip Test::Unit files\"\n+\n+ class_option :help, :type => :boolean, :aliases => \"-h\", :group => :rails,\n+ :desc => \"Show this help message and quit\"\n+ end\n+\n+ def initialize(*args)\n+ @original_wd = Dir.pwd\n+\n+ super\n+ end\n+\n+ protected\n+\n+ def builder\n+ @builder ||= begin\n+ if path = options[:builder]\n+ if URI(path).is_a?(URI::HTTP)\n+ contents = open(path, \"Accept\" => \"application/x-thor-template\") {|io| io.read }\n+ else\n+ contents = open(File.expand_path(path, @original_wd)) {|io| io.read }\n+ end\n+\n+ prok = eval(\"proc { #{contents} }\", TOPLEVEL_BINDING, path, 1)\n+ instance_eval(&prok)\n+ end\n+\n+ builder_class = get_builder_class\n+ builder_class.send(:include, ActionMethods)\n+ builder_class.new(self)\n+ end\n+ end\n+\n+ def build(meth, *args)\n+ builder.send(meth, *args) if builder.respond_to?(meth)\n+ end\n+\n+ def create_root\n+ self.destination_root = File.expand_path(app_path, destination_root)\n+ valid_const?\n+\n+ empty_directory '.'\n+ set_default_accessors!\n+ FileUtils.cd(destination_root) unless options[:pretend]\n+ end\n+\n+ def apply_rails_template\n+ apply rails_template if rails_template\n+ rescue Thor::Error, LoadError, Errno::ENOENT => e\n+ raise Error, \"The template [#{rails_template}] could not be loaded. Error: #{e}\"\n+ end\n+\n+ def set_default_accessors!\n+ self.rails_template = case options[:template]\n+ when /^http:\\/\\//\n+ options[:template]\n+ when String\n+ File.expand_path(options[:template], Dir.pwd)\n+ else\n+ options[:template]\n+ end\n+ end\n+\n+ def database_gemfile_entry\n+ entry = \"\"\n+ unless options[:skip_active_record]\n+ entry = \"gem '#{gem_for_database}'\"\n+ entry << \", :require => '#{require_for_database}'\" if require_for_database\n+ end\n+ entry\n+ end\n+\n+ def rails_gemfile_entry\n+ if options.dev?\n+ <<-GEMFILE\n+gem 'rails', :path => '#{Rails::Generators::RAILS_DEV_PATH}'\n+gem 'arel', :git => 'git://github.com/rails/arel.git'\n+gem \"rack\", :git => \"git://github.com/rack/rack.git\"\n+ GEMFILE\n+ elsif options.edge?\n+ <<-GEMFILE\n+gem 'rails', :git => 'git://github.com/rails/rails.git'\n+gem 'arel', :git => 'git://github.com/rails/arel.git'\n+gem \"rack\", :git => \"git://github.com/rack/rack.git\"\n+ GEMFILE\n+ else\n+ <<-GEMFILE\n+gem 'rails', '#{Rails::VERSION::STRING}'\n+\n+# Bundle edge Rails instead:\n+# gem 'rails', :git => 'git://github.com/rails/rails.git'\n+# gem 'arel', :git => 'git://github.com/rails/arel.git'\n+# gem \"rack\", :git => \"git://github.com/rack/rack.git\"\n+ GEMFILE\n+ end\n+ end\n+\n+ def gem_for_database\n+ # %w( mysql oracle postgresql sqlite3 frontbase ibm_db )\n+ case options[:database]\n+ when \"oracle\" then \"ruby-oci8\"\n+ when \"postgresql\" then \"pg\"\n+ when \"sqlite3\" then \"sqlite3-ruby\"\n+ when \"frontbase\" then \"ruby-frontbase\"\n+ when \"mysql\" then \"mysql2\"\n+ else options[:database]\n+ end\n+ end\n+\n+ def require_for_database\n+ case options[:database]\n+ when \"sqlite3\" then \"sqlite3\"\n+ end\n+ end\n+\n+ def bundle_if_dev_or_edge\n+ bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle')\n+ run \"#{bundle_command} install\" if dev_or_edge?\n+ end\n+\n+ def dev_or_edge?\n+ options.dev? || options.edge?\n+ end\n+ end\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c8ee939ad79202d9c6a6073c4a8d3dd02b643a2c",
filename = "railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,3 +1,4 @@\n+<% without_namespacing do -%>\n <%%= form_for(@<%= singular_table_name %>) do |f| %>\n <%% if @<%= singular_table_name %>.errors.any? %>\n <div id=\"error_explanation\">\n@@ -21,3 +22,4 @@\n <%%= f.submit %>\n </div>\n <%% end %>\n+<% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d1bfcbc429966ab063825199fc35f38e8f9e6cf4",
filename = "railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,6 +1,8 @@\n+<% without_namespacing do -%>\n <h1>Editing <%= singular_table_name %></h1>\n \n <%%= render 'form' %>\n \n <%%= link_to 'Show', @<%= singular_table_name %> %> |\n <%%= link_to 'Back', <%= index_helper %>_path %>\n+<% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "435d126ee4d3f1991cfc1b7b1760a47808f21e85",
filename = "railties/lib/rails/generators/erb/scaffold/templates/index.html.erb",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,3 +1,4 @@\n+<% without_namespacing do -%>\n <h1>Listing <%= plural_table_name %></h1>\n \n <table>\n@@ -25,3 +26,4 @@\n <br />\n \n <%%= link_to 'New <%= human_name %>', new_<%= singular_table_name %>_path %>\n+<% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "fe4d0971c4b1d7acd37fb14c3ebd36971ccd03c8",
filename = "railties/lib/rails/generators/erb/scaffold/templates/new.html.erb",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,5 +1,7 @@\n+<% without_namespacing do -%>\n <h1>New <%= singular_table_name %></h1>\n \n <%%= render 'form' %>\n \n <%%= link_to 'Back', <%= index_helper %>_path %>\n+<% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "bc3a87b99fd38d3f4c4d2c932c73f0c1f1cfb1ff",
filename = "railties/lib/rails/generators/erb/scaffold/templates/show.html.erb",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,3 +1,4 @@\n+<% without_namespacing do -%>\n <p id=\"notice\"><%%= notice %></p>\n \n <% for attribute in attributes -%>\n@@ -10,3 +11,4 @@\n \n <%%= link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>) %> |\n <%%= link_to 'Back', <%= index_helper %>_path %>\n+<% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "badf981d057d94ed7027d5afa047192cc96032e9",
filename = "railties/lib/rails/generators/named_base.rb",
status = "modified", additions = 7L, deletions = 1L, changes = 8L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/named_base.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/named_base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/named_base.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -30,9 +30,15 @@ def module_namespacing(&block)\n end\n end\n \n+ def without_namespacing(&block)\n+ inside_namespace do\n+ concat(capture(&block))\n+ end\n+ end\n+\n def indent(content, multiplier = 2)\n spaces = \" \" * multiplier\n- content.each_line.map {|line| \"#{spaces}#{line}\" }.join(\"\\n\")\n+ content = content.each_line.map {|line| \"#{spaces}#{line}\" }.join\n end\n \n def wrap_with_namespace(content)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ef1eb8d23738dfa38f7ea8f0ac8ac07bd319fe55",
filename = "railties/lib/rails/generators/rails/app/app_generator.rb",
status = "modified", additions = 10L, deletions = 127L, changes = 137L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/app/app_generator.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/app/app_generator.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/app_generator.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,9 +1,4 @@\n-require 'digest/md5'\n-require 'active_support/secure_random'\n-require 'rails/version' unless defined?(Rails::VERSION)\n-require 'rbconfig'\n-require 'open-uri'\n-require 'uri'\n+require 'rails/generators/app_base'\n \n module Rails\n module ActionMethods\n@@ -158,60 +153,16 @@ module Generators\n RESERVED_NAMES = %w[application destroy benchmarker profiler\n plugin runner test]\n \n- class AppGenerator < Base\n- DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db )\n- JAVASCRIPTS = %w( prototype jquery )\n-\n- attr_accessor :rails_template\n- add_shebang_option!\n-\n- argument :app_path, :type => :string\n-\n- class_option :database, :type => :string, :aliases => \"-d\", :default => \"sqlite3\",\n- :desc => \"Preconfigure for selected database (options: #{DATABASES.join('/')})\"\n-\n- class_option :javascript, :type => :string, :aliases => \"-j\", :default => \"prototype\",\n- :desc => \"Preconfigure for selected javascript library (options: #{JAVASCRIPTS.join('/')})\"\n-\n- class_option :builder, :type => :string, :aliases => \"-b\",\n- :desc => \"Path to an application builder (can be a filesystem path or URL)\"\n-\n- class_option :template, :type => :string, :aliases => \"-m\",\n- :desc => \"Path to an application template (can be a filesystem path or URL)\"\n-\n- class_option :dev, :type => :boolean, :default => false,\n- :desc => \"Setup the application with Gemfile pointing to your Rails checkout\"\n-\n- class_option :edge, :type => :boolean, :default => false,\n- :desc => \"Setup the application with Gemfile pointing to Rails repository\"\n-\n- class_option :skip_gemfile, :type => :boolean, :default => false,\n- :desc => \"Don't create a Gemfile\"\n-\n- class_option :skip_active_record, :type => :boolean, :aliases => \"-O\", :default => false,\n- :desc => \"Skip Active Record files\"\n-\n- class_option :skip_test_unit, :type => :boolean, :aliases => \"-T\", :default => false,\n- :desc => \"Skip Test::Unit files\"\n-\n- class_option :skip_javascript, :type => :boolean, :aliases => \"-J\", :default => false,\n- :desc => \"Skip javascript files\"\n-\n- class_option :skip_git, :type => :boolean, :aliases => \"-G\", :default => false,\n- :desc => \"Skip Git ignores and keeps\"\n+ class AppGenerator < AppBase\n+ add_shared_options_for \"application\"\n \n # Add bin/rails options\n class_option :version, :type => :boolean, :aliases => \"-v\", :group => :rails,\n :desc => \"Show Rails version number and quit\"\n \n- class_option :help, :type => :boolean, :aliases => \"-h\", :group => :rails,\n- :desc => \"Show this help message and quit\"\n-\n def initialize(*args)\n raise Error, \"Options should be given after the application name. For details run: rails --help\" if args[0].blank?\n \n- @original_wd = Dir.pwd\n-\n super\n \n if !options[:skip_active_record] && !DATABASES.include?(options[:database])\n@@ -223,14 +174,7 @@ def initialize(*args)\n end\n end\n \n- def create_root\n- self.destination_root = File.expand_path(app_path, destination_root)\n- valid_app_const?\n-\n- empty_directory '.'\n- set_default_accessors!\n- FileUtils.cd(destination_root) unless options[:pretend]\n- end\n+ public_task :create_root\n \n def create_root_files\n build(:readme)\n@@ -309,16 +253,7 @@ def finish_template\n build(:leftovers)\n end\n \n- def apply_rails_template\n- apply rails_template if rails_template\n- rescue Thor::Error, LoadError, Errno::ENOENT => e\n- raise Error, \"The template [#{rails_template}] could not be loaded. Error: #{e}\"\n- end\n-\n- def bundle_if_dev_or_edge\n- bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle')\n- run \"#{bundle_command} install\" if dev_or_edge?\n- end\n+ public_task :apply_rails_template, :bundle_if_dev_or_edge\n \n protected\n \n@@ -326,40 +261,6 @@ def self.banner\n \"rails new #{self.arguments.map(&:usage).join(' ')} [options]\"\n end\n \n- def builder\n- @builder ||= begin\n- if path = options[:builder]\n- if URI(path).is_a?(URI::HTTP)\n- contents = open(path, \"Accept\" => \"application/x-thor-template\") {|io| io.read }\n- else\n- contents = open(File.expand_path(path, @original_wd)) {|io| io.read }\n- end\n-\n- prok = eval(\"proc { #{contents} }\", TOPLEVEL_BINDING, path, 1)\n- instance_eval(&prok)\n- end\n-\n- builder_class = defined?(::AppBuilder) ? ::AppBuilder : Rails::AppBuilder\n- builder_class.send(:include, ActionMethods)\n- builder_class.new(self)\n- end\n- end\n-\n- def build(meth, *args)\n- builder.send(meth, *args) if builder.respond_to?(meth)\n- end\n-\n- def set_default_accessors!\n- self.rails_template = case options[:template]\n- when /^http:\\/\\//\n- options[:template]\n- when String\n- File.expand_path(options[:template], Dir.pwd)\n- else\n- options[:template]\n- end\n- end\n-\n # Define file as an alias to create_file for backwards compatibility.\n def file(*args, &block)\n create_file(*args, &block)\n@@ -388,7 +289,7 @@ def app_const\n @app_const ||= \"#{app_const_base}::Application\"\n end\n \n- def valid_app_const?\n+ def valid_const?\n if app_const =~ /^\\d/\n raise Error, \"Invalid application name #{app_name}. Please give a name which does not start with numbers.\"\n elsif RESERVED_NAMES.include?(app_name)\n@@ -402,28 +303,6 @@ def app_secret\n ActiveSupport::SecureRandom.hex(64)\n end\n \n- def dev_or_edge?\n- options.dev? || options.edge?\n- end\n-\n- def gem_for_database\n- # %w( mysql oracle postgresql sqlite3 frontbase ibm_db )\n- case options[:database]\n- when \"oracle\" then \"ruby-oci8\"\n- when \"postgresql\" then \"pg\"\n- when \"sqlite3\" then \"sqlite3-ruby\"\n- when \"frontbase\" then \"ruby-frontbase\"\n- when \"mysql\" then \"mysql2\"\n- else options[:database]\n- end\n- end\n-\n- def require_for_database\n- case options[:database]\n- when \"sqlite3\" then \"sqlite3\"\n- end\n- end\n-\n def mysql_socket\n @mysql_socket ||= [\n \"/tmp/mysql.sock\", # default\n@@ -442,6 +321,10 @@ def empty_directory_with_gitkeep(destination, config = {})\n empty_directory(destination, config)\n create_file(\"#{destination}/.gitkeep\") unless options[:skip_git]\n end\n+\n+ def get_builder_class\n+ defined?(::AppBuilder) ? ::AppBuilder : Rails::AppBuilder\n+ end\n end\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "86b9e8f40c4a7c75abf1999d902a553522e5f0aa",
filename = "railties/lib/rails/generators/rails/app/templates/Gemfile",
status = "modified", additions = 2L, deletions = 19L, changes = 21L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/app/templates/Gemfile",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/app/templates/Gemfile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/Gemfile?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,25 +1,8 @@\n source 'http://rubygems.org'\n \n-<%- if options.dev? -%>\n-gem 'rails', :path => '<%= Rails::Generators::RAILS_DEV_PATH %>'\n-gem 'arel', :git => 'git://github.com/rails/arel.git'\n-gem \"rack\", :git => \"git://github.com/rack/rack.git\"\n-<%- elsif options.edge? -%>\n-gem 'rails', :git => 'git://github.com/rails/rails.git'\n-gem 'arel', :git => 'git://github.com/rails/arel.git'\n-gem \"rack\", :git => \"git://github.com/rack/rack.git\"\n-<%- else -%>\n-gem 'rails', '<%= Rails::VERSION::STRING %>'\n+<%= rails_gemfile_entry -%>\n \n-# Bundle edge Rails instead:\n-# gem 'rails', :git => 'git://github.com/rails/rails.git'\n-# gem 'arel', :git => 'git://github.com/rails/arel.git'\n-# gem \"rack\", :git => \"git://github.com/rack/rack.git\"\n-<%- end -%>\n-\n-<% unless options[:skip_active_record] -%>\n-gem '<%= gem_for_database %>'<% if require_for_database %>, :require => '<%= require_for_database %>'<% end %>\n-<% end -%>\n+<%= database_gemfile_entry -%>\n \n # Use unicorn as the web server\n # gem 'unicorn'"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "9a7bf9f396439ea67fdbd9e62cbbf9b3d0b4a4f1",
filename = "railties/lib/rails/generators/rails/plugin_new/USAGE",
status = "added", additions = 10L, deletions = 0L, changes = 10L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/USAGE",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/USAGE",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/USAGE?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,10 @@\n+Description:\n+ The 'rails plugin new' command creates a skeleton for developing any\n+ kind of Rails extension with ability to run tests using dummy Rails\n+ application.\n+\n+Example:\n+ rails plugin new ~/Code/Ruby/blog\n+\n+ This generates a skeletal Rails plugin in ~/Code/Ruby/blog.\n+ See the README in the newly created plugin to get going."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "8fac6fc70a72f6cc668293b9300409fce6bd737b",
filename = "railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb",
status = "added", additions = 246L, deletions = 0L, changes = 246L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,246 @@\n+require 'active_support/core_ext/hash/slice'\n+require \"rails/generators/rails/app/app_generator\"\n+\n+module Rails\n+ class PluginBuilder\n+ def rakefile\n+ template \"Rakefile\"\n+ end\n+\n+ def app\n+ directory \"app\" if options[:mountable]\n+ end\n+\n+ def readme\n+ copy_file \"README.rdoc\"\n+ end\n+\n+ def gemfile\n+ template \"Gemfile\"\n+ end\n+\n+ def license\n+ template \"MIT-LICENSE\"\n+ end\n+\n+ def gemspec\n+ template \"%name%.gemspec\"\n+ end\n+\n+ def gitignore\n+ copy_file \"gitignore\", \".gitignore\"\n+ end\n+\n+ def lib\n+ template \"lib/%name%.rb\"\n+ template \"lib/tasks/%name%_tasks.rake\"\n+ if full?\n+ template \"lib/%name%/engine.rb\"\n+ end\n+ end\n+\n+ def config\n+ template \"config/routes.rb\" if mountable?\n+ end\n+\n+ def test\n+ template \"test/test_helper.rb\"\n+ template \"test/%name%_test.rb\"\n+ append_file \"Rakefile\", <<-EOF\n+#{rakefile_test_tasks}\n+\n+task :default => :test\n+ EOF\n+ if full?\n+ template \"test/integration/navigation_test.rb\"\n+ end\n+ end\n+\n+ def generate_test_dummy(force = false)\n+ opts = (options || {}).slice(:skip_active_record, :skip_javascript, :database, :javascript)\n+ opts[:force] = force\n+\n+ invoke Rails::Generators::AppGenerator,\n+ [ File.expand_path(dummy_path, destination_root) ], opts\n+ end\n+\n+ def test_dummy_config\n+ template \"rails/boot.rb\", \"#{dummy_path}/config/boot.rb\", :force => true\n+ template \"rails/application.rb\", \"#{dummy_path}/config/application.rb\", :force => true\n+ if mountable?\n+ template \"rails/routes.rb\", \"#{dummy_path}/config/routes.rb\", :force => true\n+ end\n+ end\n+\n+ def test_dummy_clean\n+ inside dummy_path do\n+ remove_file \".gitignore\"\n+ remove_file \"db/seeds.rb\"\n+ remove_file \"doc\"\n+ remove_file \"Gemfile\"\n+ remove_file \"lib/tasks\"\n+ remove_file \"public/images/rails.png\"\n+ remove_file \"public/index.html\"\n+ remove_file \"public/robots.txt\"\n+ remove_file \"README\"\n+ remove_file \"test\"\n+ remove_file \"vendor\"\n+ end\n+ end\n+\n+ def script(force = false)\n+ directory \"script\", :force => force do |content|\n+ \"#{shebang}\\n\" + content\n+ end\n+ chmod \"script\", 0755, :verbose => false\n+ end\n+ end\n+\n+ module Generators\n+ class PluginNewGenerator < AppBase\n+ add_shared_options_for \"plugin\"\n+\n+ alias_method :plugin_path, :app_path\n+\n+ class_option :dummy_path, :type => :string, :default => \"test/dummy\",\n+ :desc => \"Create dummy application at given path\"\n+\n+ class_option :full, :type => :boolean, :default => false,\n+ :desc => \"Generate rails engine with integration tests\"\n+\n+ class_option :mountable, :type => :boolean, :default => false,\n+ :desc => \"Generate mountable isolated application\"\n+\n+ def initialize(*args)\n+ raise Error, \"Options should be given after the plugin name. For details run: rails plugin --help\" if args[0].blank?\n+\n+ super\n+ end\n+\n+ public_task :create_root\n+\n+ def create_root_files\n+ build(:readme)\n+ build(:rakefile)\n+ build(:gemspec)\n+ build(:license)\n+ build(:gitignore) unless options[:skip_git]\n+ build(:gemfile) unless options[:skip_gemfile]\n+ end\n+\n+ def create_app_files\n+ build(:app)\n+ end\n+\n+ def create_config_files\n+ build(:config)\n+ end\n+\n+ def create_lib_files\n+ build(:lib)\n+ end\n+\n+ def create_script_files\n+ build(:script)\n+ end\n+\n+ def create_test_files\n+ build(:test) unless options[:skip_test_unit]\n+ end\n+\n+ def create_test_dummy_files\n+ return if options[:skip_test_unit]\n+ create_dummy_app\n+ end\n+\n+ def finish_template\n+ build(:leftovers)\n+ end\n+\n+ public_task :apply_rails_template, :bundle_if_dev_or_edge\n+\n+ protected\n+ def create_dummy_app(path = nil)\n+ dummy_path(path) if path\n+\n+ say_status :vendor_app, dummy_path\n+ mute do\n+ build(:generate_test_dummy)\n+ store_application_definition!\n+ build(:test_dummy_config)\n+ build(:test_dummy_clean)\n+ # ensure that script/rails has proper dummy_path\n+ build(:script, true)\n+ end\n+ end\n+\n+ def full?\n+ options[:full] || options[:mountable]\n+ end\n+\n+ def mountable?\n+ options[:mountable]\n+ end\n+\n+ def self.banner\n+ \"rails plugin new #{self.arguments.map(&:usage).join(' ')} [options]\"\n+ end\n+\n+ def name\n+ @name ||= File.basename(destination_root)\n+ end\n+\n+ def camelized\n+ @camelized ||= name.gsub(/\\W/, '_').squeeze('_').camelize\n+ end\n+\n+ def valid_const?\n+ if camelized =~ /^\\d/\n+ raise Error, \"Invalid plugin name #{name}. Please give a name which does not start with numbers.\"\n+ elsif RESERVED_NAMES.include?(name)\n+ raise Error, \"Invalid plugin name #{name}. Please give a name which does not match one of the reserved rails words.\"\n+ elsif Object.const_defined?(camelized)\n+ raise Error, \"Invalid plugin name #{name}, constant #{camelized} is already in use. Please choose another application name.\"\n+ end\n+ end\n+\n+ def application_definition\n+ @application_definition ||= begin\n+\n+ dummy_application_path = File.expand_path(\"#{dummy_path}/config/application.rb\", destination_root)\n+ unless options[:pretend] || !File.exists?(dummy_application_path)\n+ contents = File.read(dummy_application_path)\n+ contents[(contents.index(\"module Dummy\"))..-1]\n+ end\n+ end\n+ end\n+ alias :store_application_definition! :application_definition\n+\n+ def get_builder_class\n+ defined?(::PluginBuilder) ? ::PluginBuilder : Rails::PluginBuilder\n+ end\n+\n+ def rakefile_test_tasks\n+ <<-RUBY\n+require 'rake/testtask'\n+\n+Rake::TestTask.new(:test) do |t|\n+ t.libs << 'lib'\n+ t.libs << 'test'\n+ t.pattern = 'test/**/*_test.rb'\n+ t.verbose = false\n+end\n+ RUBY\n+ end\n+\n+ def dummy_path(path = nil)\n+ @dummy_path = path if path\n+ @dummy_path || options[:dummy_path]\n+ end\n+\n+ def mute(&block)\n+ shell.mute(&block)\n+ end\n+ end\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "3d9bfb22c70ad7df180d7f069f88a262bb98252e",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec",
status = "added", additions = 9L, deletions = 0L, changes = 9L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/%25name%25.gemspec",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/%25name%25.gemspec",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/%25name%25.gemspec?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,9 @@\n+# Provide a simple gemspec so you can easily use your\n+# project in your rails apps through git.\n+Gem::Specification.new do |s|\n+ s.name = \"<%= name %>\"\n+ s.summary = \"Insert <%= camelized %> summary.\"\n+ s.description = \"Insert <%= camelized %> description.\"\n+ s.files = Dir[\"lib/**/*\"] + [\"MIT-LICENSE\", \"Rakefile\", \"README.rdoc\"]\n+ s.version = \"0.0.1\"\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "29900c93dc0feb2486112745029b7b8fb2ba68c8",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/Gemfile",
status = "added", additions = 11L, deletions = 0L, changes = 11L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/Gemfile",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/Gemfile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/Gemfile?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,11 @@\n+source \"http://rubygems.org\"\n+\n+<%= rails_gemfile_entry -%>\n+\n+<% if full? -%>\n+<%= database_gemfile_entry -%>\n+<% end -%>\n+\n+if RUBY_VERSION < '1.9'\n+ gem \"ruby-debug\", \">= 0.10.3\"\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d7a9109894a692147dc33e29af73a2a2291c371e",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/MIT-LICENSE",
status = "added", additions = 20L, deletions = 0L, changes = 20L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/MIT-LICENSE",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/MIT-LICENSE",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/MIT-LICENSE?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,20 @@\n+Copyright <%= Date.today.year %> YOURNAME\n+\n+Permission is hereby granted, free of charge, to any person obtaining\n+a copy of this software and associated documentation files (the\n+\"Software\"), to deal in the Software without restriction, including\n+without limitation the rights to use, copy, modify, merge, publish,\n+distribute, sublicense, and/or sell copies of the Software, and to\n+permit persons to whom the Software is furnished to do so, subject to\n+the following conditions:\n+\n+The above copyright notice and this permission notice shall be\n+included in all copies or substantial portions of the Software.\n+\n+THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "301d647731ec91c8819756b8d880730979390815",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/README.rdoc",
status = "added", additions = 3L, deletions = 0L, changes = 3L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/README.rdoc",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/README.rdoc",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/README.rdoc?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,3 @@\n+= <%= camelized %>\n+\n+This project rocks and uses MIT-LICENSE.\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "88f50f9f046ad978f82642b7de61eae9527eecbd",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/Rakefile",
status = "added", additions = 18L, deletions = 0L, changes = 18L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,18 @@\n+# encoding: UTF-8\n+require 'rubygems'\n+begin\n+ require 'bundler/setup'\n+rescue LoadError\n+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'\n+end\n+\n+require 'rake'\n+require 'rake/rdoctask'\n+\n+Rake::RDocTask.new(:rdoc) do |rdoc|\n+ rdoc.rdoc_dir = 'rdoc'\n+ rdoc.title = '<%= camelized %>'\n+ rdoc.options << '--line-numbers' << '--inline-source'\n+ rdoc.rdoc_files.include('README.rdoc')\n+ rdoc.rdoc_files.include('lib/**/*.rb')\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "f225bc9f7ffc9a3ef429804ea40ecff1d3549931",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/app/controllers/%name%/application_controller.rb.tt",
status = "added", additions = 4L, deletions = 0L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/app/controllers/%25name%25/application_controller.rb.tt",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/app/controllers/%25name%25/application_controller.rb.tt",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/app/controllers/%25name%25/application_controller.rb.tt?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,4 @@\n+module <%= camelized %>\n+ class ApplicationController < ActiveController::Base\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "40ae9f52c27ad7a7fd65e18094b7346d20e8a054",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/app/helpers/%name%/application_helper.rb.tt",
status = "added", additions = 4L, deletions = 0L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/app/helpers/%25name%25/application_helper.rb.tt",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/app/helpers/%25name%25/application_helper.rb.tt",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/app/helpers/%25name%25/application_helper.rb.tt?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,4 @@\n+module <%= camelized %>\n+ module ApplicationHelper\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "42ddf380d8c57458f795e008ac3d4a9fcc123031",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/config/routes.rb",
status = "added", additions = 3L, deletions = 0L, changes = 3L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/config/routes.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/config/routes.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/config/routes.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,3 @@\n+<%= camelized %>::Engine.routes.draw do\n+\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "1463de6dfb5941fd3fd54a9bd0b5c23f3ffe6c1c",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/gitignore",
status = "added", additions = 6L, deletions = 0L, changes = 6L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/gitignore",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/gitignore",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/gitignore?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,6 @@\n+.bundle/\n+log/*.log\n+pkg/\n+test/dummy/db/*.sqlite3\n+test/dummy/log/*.log\n+test/dummy/tmp/\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "2d3bdc510c50d7965a59fad75b7869f8accdf389",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/lib/%name%.rb",
status = "added", additions = 6L, deletions = 0L, changes = 6L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/lib/%25name%25.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/lib/%25name%25.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/lib/%25name%25.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,6 @@\n+<% if full? -%>\n+require \"<%= name %>/engine\"\n+\n+<% end -%>\n+module <%= camelized %>\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "9600ee0c3fdf04200667323af4e797e88014e713",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/lib/%name%/engine.rb",
status = "added", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/lib/%25name%25/engine.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/lib/%25name%25/engine.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/lib/%25name%25/engine.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,7 @@\n+module <%= camelized %>\n+ class Engine < Rails::Engine\n+<% if mountable? -%>\n+ isolate_namespace <%= camelized %>\n+<% end -%>\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "7121f5ae23b10cb673aa0729eb0be0687524e919",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/lib/tasks/%name%_tasks.rake",
status = "added", additions = 4L, deletions = 0L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/lib/tasks/%25name%25_tasks.rake",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/lib/tasks/%25name%25_tasks.rake",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/lib/tasks/%25name%25_tasks.rake?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,4 @@\n+# desc \"Explaining what the task does\"\n+# task :<%= name %> do\n+# # Task goes here\n+# end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "8b68280a5e3fee896a3b310934cff156a649331c",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/rails/application.rb",
status = "added", additions = 16L, deletions = 0L, changes = 16L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/rails/application.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/rails/application.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/rails/application.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,16 @@\n+require File.expand_path('../boot', __FILE__)\n+\n+<% unless options[:skip_active_record] -%>\n+require 'rails/all'\n+<% else -%>\n+# require \"active_record/railtie\"\n+require \"action_controller/railtie\"\n+require \"action_mailer/railtie\"\n+require \"active_resource/railtie\"\n+require \"rails/test_unit/railtie\"\n+<% end -%>\n+\n+Bundler.require\n+require \"<%= name %>\"\n+\n+<%= application_definition %>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "eba068137040ef8ed142c71a48b0c14eb41d6575",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/rails/boot.rb",
status = "added", additions = 10L, deletions = 0L, changes = 10L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/rails/boot.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/rails/boot.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/rails/boot.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,10 @@\n+require 'rubygems'\n+gemfile = File.expand_path('../../../../Gemfile', __FILE__)\n+\n+if File.exist?(gemfile)\n+ ENV['BUNDLE_GEMFILE'] = gemfile\n+ require 'bundler'\n+ Bundler.setup\n+end\n+\n+$:.unshift File.expand_path('../../../../lib', __FILE__)\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "730ee31c3d5ae8aa02073874bb758d96ebbedd8b",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/rails/routes.rb",
status = "added", additions = 4L, deletions = 0L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/rails/routes.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/rails/routes.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/rails/routes.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,4 @@\n+Rails.application.routes.draw do\n+\n+ mount <%= camelized %>::Engine => \"/<%= name %>\"\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ebd5a77dd535be641ce6430df25ed27e8ec08ba1",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt",
status = "added", additions = 5L, deletions = 0L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,5 @@\n+#!/usr/bin/env ruby\n+# This command will automatically be run when you run \"rails\" with Rails 3 gems installed from the root of your application.\n+\n+ENGINE_PATH = File.expand_path('../..', __FILE__)\n+load File.expand_path('../../<%= dummy_path %>/script/rails', __FILE__)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "0a8bbd4aaf441e8123f29fc54a2cd997b3453769",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/test/%name%_test.rb",
status = "added", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/test/%25name%25_test.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/test/%25name%25_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/test/%25name%25_test.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,7 @@\n+require 'test_helper'\n+\n+class <%= camelized %>Test < ActiveSupport::TestCase\n+ test \"truth\" do\n+ assert_kind_of Module, <%= camelized %>\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d06fe7cbd094a51bc2f067b9deadeab57212389a",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/test/integration/navigation_test.rb",
status = "added", additions = 11L, deletions = 0L, changes = 11L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/test/integration/navigation_test.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/test/integration/navigation_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/test/integration/navigation_test.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,11 @@\n+require 'test_helper'\n+\n+class NavigationTest < ActionDispatch::IntegrationTest\n+ fixtures :all\n+\n+ # Replace this with your real tests.\n+ test \"the truth\" do\n+ assert true\n+ end\n+end\n+"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "dbcaf6b92fb8f837b5b6f4bdc48e52454c54ec37",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb",
status = "added", additions = 17L, deletions = 0L, changes = 17L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,17 @@\n+# Configure Rails Envinronment\n+ENV[\"RAILS_ENV\"] = \"test\"\n+\n+require File.expand_path(\"../dummy/config/environment.rb\", __FILE__)\n+require \"rails/test_help\"\n+\n+Rails.backtrace_cleaner.remove_silencers!\n+\n+<% if full? && !options[:skip_active_record] -%>\n+# Run any available migration from application\n+ActiveRecord::Migrator.migrate File.expand_path(\"../dummy/db/migrate/\", __FILE__)\n+# and from engine\n+ActiveRecord::Migrator.migrate File.expand_path(\"../../db/migrate/\", __FILE__)\n+<% end -%>\n+\n+# Load support files\n+Dir[\"#{File.dirname(__FILE__)}/support/**/*.rb\"].each { |f| require f }"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c7345f3cfbf03bde4815db8d406708005d72efd7",
filename = "railties/lib/rails/generators/rails/resource/resource_generator.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/resource/resource_generator.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/resource/resource_generator.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/resource/resource_generator.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -16,9 +16,9 @@ class ResourceGenerator < ModelGenerator #metagenerator\n \n def add_resource_route\n return if options[:actions].present?\n- route_config = class_path.collect{|namespace| \"namespace :#{namespace} do \" }.join(\" \")\n+ route_config = regular_class_path.collect{|namespace| \"namespace :#{namespace} do \" }.join(\" \")\n route_config << \"resources :#{file_name.pluralize}\"\n- route_config << \" end\" * class_path.size\n+ route_config << \" end\" * regular_class_path.size\n route route_config\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "b5317a055b3ca016d56fa995a1a14c58fbeb8f82",
filename = "railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,3 +1,4 @@\n+<% module_namespacing do -%>\n class <%= controller_class_name %>Controller < ApplicationController\n # GET <%= route_url %>\n # GET <%= route_url %>.xml\n@@ -81,3 +82,4 @@ def destroy\n end\n end\n end\n+<% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c9e70468a1bbe77f7af564a671c9e6807c828f4e",
filename = "railties/lib/rails/generators/resource_helpers.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/resource_helpers.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/resource_helpers.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/resource_helpers.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -34,7 +34,7 @@ def initialize(*args) #:nodoc:\n attr_reader :controller_name\n \n def controller_class_path\n- @class_path\n+ class_path\n end\n \n def controller_file_name\n@@ -46,7 +46,7 @@ def controller_file_path\n end\n \n def controller_class_name\n- @controller_class_name ||= (controller_class_path + [controller_file_name]).map!{ |m| m.camelize }.join('::')\n+ (controller_class_path + [controller_file_name]).map!{ |m| m.camelize }.join('::')\n end\n \n def controller_i18n_scope"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "964d59d84c66b74a5a576b5b8bf4b6c0780b784e",
filename = "railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,5 +1,6 @@\n require 'test_helper'\n \n+<% module_namespacing do -%>\n class <%= controller_class_name %>ControllerTest < ActionController::TestCase\n setup do\n @<%= singular_table_name %> = <%= table_name %>(:one)\n@@ -47,3 +48,4 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase\n assert_redirected_to <%= index_helper %>_path\n end\n end\n+<% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = NULL,
filename = "railties/test/fixtures/lib/app_builders/empty_builder.rb",
status = "renamed", additions = 0L, deletions = 0L, changes = 0L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/app_builders/empty_builder.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/app_builders/empty_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/app_builders/empty_builder.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url")), structure(list(sha = "993d3a2aa2766bf0f55eae21635af65480eb58d1",
filename = "railties/test/fixtures/lib/app_builders/simple_builder.rb",
status = "added", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/app_builders/simple_builder.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/app_builders/simple_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/app_builders/simple_builder.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,7 @@\n+class AppBuilder\n+ def gitignore\n+ create_file \".gitignore\", <<-R.strip\n+foobar\n+ R\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "cb50be01cb6c16edf0f6190d4e9491c18277faf0",
filename = "railties/test/fixtures/lib/app_builders/tweak_builder.rb",
status = "added", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/app_builders/tweak_builder.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/app_builders/tweak_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/app_builders/tweak_builder.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,7 @@\n+class AppBuilder < Rails::AppBuilder\n+ def gitignore\n+ create_file \".gitignore\", <<-R.strip\n+foobar\n+ R\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "e4378bbd1a51aef9b4d1f5bfdb64e683a87bedf6",
filename = "railties/test/fixtures/lib/create_test_dummy_template.rb",
status = "added", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/create_test_dummy_template.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/create_test_dummy_template.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/create_test_dummy_template.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1 @@\n+create_dummy_app(\"spec/dummy\")"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "5c5607621c8f723eca5455da8c7e36e241a01260",
filename = "railties/test/fixtures/lib/plugin_builders/empty_builder.rb",
status = "added", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/plugin_builders/empty_builder.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/plugin_builders/empty_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/plugin_builders/empty_builder.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,2 @@\n+class PluginBuilder\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "08f6c5535da5f6d8aa5aa3a7b3ff00aac3f598cc",
filename = "railties/test/fixtures/lib/plugin_builders/simple_builder.rb",
status = "added", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/plugin_builders/simple_builder.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/plugin_builders/simple_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/plugin_builders/simple_builder.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,7 @@\n+class PluginBuilder\n+ def gitignore\n+ create_file \".gitignore\", <<-R.strip\n+foobar\n+ R\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "aa18c7ddaa67b053e75ba0ffafc239c6fe33fc8c",
filename = "railties/test/fixtures/lib/plugin_builders/spec_builder.rb",
status = "added", additions = 19L, deletions = 0L, changes = 19L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/plugin_builders/spec_builder.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/plugin_builders/spec_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/plugin_builders/spec_builder.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,19 @@\n+class PluginBuilder < Rails::PluginBuilder\n+ def test\n+ create_file \"spec/spec_helper.rb\"\n+ append_file \"Rakefile\", <<-EOF\n+# spec tasks in rakefile\n+\n+task :default => :spec\n+ EOF\n+ end\n+\n+ def generate_test_dummy\n+ dummy_path(\"spec/dummy\")\n+ super\n+ end\n+\n+ def skip_test_unit?\n+ true\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "1e801409a43ccb1f11d28b8e8161c89cd2d28642",
filename = "railties/test/fixtures/lib/plugin_builders/tweak_builder.rb",
status = "added", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/plugin_builders/tweak_builder.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/fixtures/lib/plugin_builders/tweak_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/plugin_builders/tweak_builder.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,7 @@\n+class PluginBuilder < Rails::PluginBuilder\n+ def gitignore\n+ create_file \".gitignore\", <<-R.strip\n+foobar\n+ R\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "47dcdc0d96af8cc4959d090875f0f3b65b123a77",
filename = "railties/test/fixtures/lib/simple_builder.rb",
status = "removed", additions = 0L, deletions = 7L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/d446392f76c063d9f04396a1d3ca9e314a521671/railties/test/fixtures/lib/simple_builder.rb",
raw_url = "https://github.com/rails/rails/raw/d446392f76c063d9f04396a1d3ca9e314a521671/railties/test/fixtures/lib/simple_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/simple_builder.rb?ref=d446392f76c063d9f04396a1d3ca9e314a521671",
patch = "@@ -1,7 +0,0 @@\n-class AppBuilder\n- def configru\n- create_file \"config.ru\", <<-R.strip\n-run proc { |env| [200, { \"Content-Type\" => \"text/html\" }, [\"Hello World\"]] }\n- R\n- end\n-end\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "eed20ecc9b88a7818db27969967b9a148b61230e",
filename = "railties/test/fixtures/lib/tweak_builder.rb",
status = "removed", additions = 0L, deletions = 7L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/d446392f76c063d9f04396a1d3ca9e314a521671/railties/test/fixtures/lib/tweak_builder.rb",
raw_url = "https://github.com/rails/rails/raw/d446392f76c063d9f04396a1d3ca9e314a521671/railties/test/fixtures/lib/tweak_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/fixtures/lib/tweak_builder.rb?ref=d446392f76c063d9f04396a1d3ca9e314a521671",
patch = "@@ -1,7 +0,0 @@\n-class AppBuilder < Rails::AppBuilder\n- def configru\n- create_file \"config.ru\", <<-R.strip\n-run proc { |env| [200, { \"Content-Type\" => \"text/html\" }, [\"Hello World\"]] }\n- R\n- end\n-end\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "6b2026ad0c4b1651459c1df439f536aa62f46ad2",
filename = "railties/test/generators/app_generator_test.rb",
status = "modified", additions = 12L, deletions = 146L, changes = 158L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/generators/app_generator_test.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/generators/app_generator_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/generators/app_generator_test.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -1,6 +1,7 @@\n require 'abstract_unit'\n require 'generators/generators_test_helper'\n require 'rails/generators/rails/app/app_generator'\n+require 'generators/shared_generator_tests.rb'\n \n DEFAULT_APP_FILES = %w(\n .gitignore\n@@ -40,36 +41,10 @@\n class AppGeneratorTest < Rails::Generators::TestCase\n include GeneratorsTestHelper\n arguments [destination_root]\n+ include SharedGeneratorTests\n \n- def setup\n- Rails.application = TestApp::Application\n- super\n- Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)\n- @bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle')\n- \n- Kernel::silence_warnings do\n- Thor::Base.shell.send(:attr_accessor, :always_force)\n- @shell = Thor::Base.shell.new\n- @shell.send(:always_force=, true)\n- end\n- end\n-\n- def teardown\n- super\n- Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)\n- Rails.application = TestApp::Application.instance\n- end\n-\n- def test_application_skeleton_is_created\n- run_generator\n-\n- DEFAULT_APP_FILES.each{ |path| assert_file path }\n- end\n-\n- def test_application_generate_pretend\n- run_generator [\"testapp\", \"--pretend\"]\n-\n- DEFAULT_APP_FILES.each{ |path| assert_no_file path }\n+ def default_files\n+ ::DEFAULT_APP_FILES\n end\n \n def test_application_controller_and_layout_files\n@@ -78,36 +53,11 @@ def test_application_controller_and_layout_files\n assert_no_file \"public/stylesheets/application.css\"\n end\n \n- def test_options_before_application_name_raises_an_error\n- content = capture(:stderr){ run_generator([\"--skip-active-record\", destination_root]) }\n- assert_equal \"Options should be given after the application name. For details run: rails --help\\n\", content\n- end\n-\n- def test_name_collision_raises_an_error\n- reserved_words = %w[application destroy plugin runner test]\n- reserved_words.each do |reserved|\n- content = capture(:stderr){ run_generator [File.join(destination_root, reserved)] }\n- assert_equal \"Invalid application name #{reserved}. Please give a name which does not match one of the reserved rails words.\\n\", content\n- end\n- end\n-\n- def test_invalid_database_option_raises_an_error\n- content = capture(:stderr){ run_generator([destination_root, \"-d\", \"unknown\"]) }\n- assert_match /Invalid value for \\-\\-database option/, content\n- end\n-\n def test_invalid_application_name_raises_an_error\n content = capture(:stderr){ run_generator [File.join(destination_root, \"43-things\")] }\n assert_equal \"Invalid application name 43-things. Please give a name which does not start with numbers.\\n\", content\n end\n \n- def test_application_name_raises_an_error_if_name_already_used_constant\n- %w{ String Hash Class Module Set Symbol }.each do |ruby_class|\n- content = capture(:stderr){ run_generator [File.join(destination_root, ruby_class)] }\n- assert_equal \"Invalid application name #{ruby_class}, constant #{ruby_class} is already in use. Please choose another application name.\\n\", content\n- end\n- end\n-\n def test_invalid_application_name_is_fixed\n run_generator [File.join(destination_root, \"things-43\")]\n assert_file \"things-43/config/environment.rb\", /Things43::Application\\.initialize!/\n@@ -188,11 +138,6 @@ def test_prototype_and_test_unit_are_added_by_default\n assert_file \"test\"\n end\n \n- def test_test_unit_is_skipped_if_required\n- run_generator [destination_root, \"--skip-test-unit\"]\n- assert_no_file \"test\" \n- end\n- \n def test_javascript_is_skipped_if_required\n run_generator [destination_root, \"--skip-javascript\"]\n assert_file \"config/application.rb\", /^\\s+config\\.action_view\\.javascript_expansions\\[:defaults\\]\\s+=\\s+%w\\(\\)/\n@@ -217,36 +162,11 @@ def test_config_jquery_javascript_library\n assert_file \"public/javascripts/rails.js\", /jQuery/\n end\n \n- def test_shebang_is_added_to_rails_file\n- run_generator [destination_root, \"--ruby\", \"foo/bar/baz\"]\n- assert_file \"script/rails\", /#!foo\\/bar\\/baz/\n- end\n-\n- def test_shebang_when_is_the_same_as_default_use_env\n- run_generator [destination_root, \"--ruby\", Thor::Util.ruby_command]\n- assert_file \"script/rails\", /#!\\/usr\\/bin\\/env/\n- end\n-\n def test_template_from_dir_pwd\n FileUtils.cd(Rails.root)\n assert_match /It works from file!/, run_generator([destination_root, \"-m\", \"lib/template.rb\"])\n end\n \n- def test_template_raises_an_error_with_invalid_path\n- content = capture(:stderr){ run_generator([destination_root, \"-m\", \"non/existant/path\"]) }\n- assert_match /The template \\[.*\\] could not be loaded/, content\n- assert_match /non\\/existant\\/path/, content\n- end\n-\n- def test_template_is_executed_when_supplied\n- path = \"http://gist.github.com/103208.txt\"\n- template = %{ say \"It works!\" }\n- template.instance_eval \"def read; self; end\" # Make the string respond to read\n-\n- generator([destination_root], :template => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template)\n- assert_match /It works!/, silence(:stdout){ generator.invoke_all }\n- end\n-\n def test_usage_read_from_file\n File.expects(:read).returns(\"USAGE FROM FILE\")\n assert_equal \"USAGE FROM FILE\", Rails::Generators::AppGenerator.desc\n@@ -266,19 +186,6 @@ def test_file_is_added_for_backwards_compatibility\n assert_file 'lib/test_file.rb', 'heres test data'\n end\n \n- def test_dev_option\n- generator([destination_root], :dev => true).expects(:run).with(\"#{@bundle_command} install\")\n- silence(:stdout){ generator.invoke_all }\n- rails_path = File.expand_path('../../..', Rails.root)\n- assert_file 'Gemfile', /^gem\\s+[\"']rails[\"'],\\s+:path\\s+=>\\s+[\"']#{Regexp.escape(rails_path)}[\"']$/\n- end\n-\n- def test_edge_option\n- generator([destination_root], :edge => true).expects(:run).with(\"#{@bundle_command} install\")\n- silence(:stdout){ generator.invoke_all }\n- assert_file 'Gemfile', /^gem\\s+[\"']rails[\"'],\\s+:git\\s+=>\\s+[\"']#{Regexp.escape(\"git://github.com/rails/rails.git\")}[\"']$/\n- end\n-\n protected\n \n def action(*args, &block)\n@@ -292,62 +199,21 @@ class CustomAppGeneratorTest < Rails::Generators::TestCase\n tests Rails::Generators::AppGenerator\n \n arguments [destination_root]\n+ include SharedCustomGeneratorTests\n \n- def setup\n- Rails.application = TestApp::Application\n- super\n- Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)\n- @bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle')\n- end\n-\n- def teardown\n- super\n- Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)\n- Object.class_eval { remove_const :AppBuilder if const_defined?(:AppBuilder) }\n- Rails.application = TestApp::Application.instance\n- end\n-\n- def test_builder_option_with_empty_app_builder\n- FileUtils.cd(Rails.root)\n- run_generator([destination_root, \"-b\", \"#{Rails.root}/lib/empty_builder.rb\"])\n- DEFAULT_APP_FILES.each{ |path| assert_no_file path }\n- end\n-\n- def test_builder_option_with_simple_app_builder\n- FileUtils.cd(Rails.root)\n- run_generator([destination_root, \"-b\", \"#{Rails.root}/lib/simple_builder.rb\"])\n- (DEFAULT_APP_FILES - ['config.ru']).each{ |path| assert_no_file path }\n- assert_file \"config.ru\", %[run proc { |env| [200, { \"Content-Type\" => \"text/html\" }, [\"Hello World\"]] }]\n- end\n-\n- def test_builder_option_with_relative_path\n- here = File.expand_path(File.dirname(__FILE__))\n- FileUtils.cd(here)\n- run_generator([destination_root, \"-b\", \"../fixtures/lib/simple_builder.rb\"])\n- (DEFAULT_APP_FILES - ['config.ru']).each{ |path| assert_no_file path }\n- assert_file \"config.ru\", %[run proc { |env| [200, { \"Content-Type\" => \"text/html\" }, [\"Hello World\"]] }]\n+protected\n+ def default_files\n+ ::DEFAULT_APP_FILES\n end\n \n- def test_builder_option_with_tweak_app_builder\n- FileUtils.cd(Rails.root)\n- run_generator([destination_root, \"-b\", \"#{Rails.root}/lib/tweak_builder.rb\"])\n- DEFAULT_APP_FILES.each{ |path| assert_file path }\n- assert_file \"config.ru\", %[run proc { |env| [200, { \"Content-Type\" => \"text/html\" }, [\"Hello World\"]] }]\n+ def builders_dir\n+ \"app_builders\"\n end\n \n- def test_builder_option_with_http\n- path = \"http://gist.github.com/103208.txt\"\n- template = \"class AppBuilder; end\"\n- template.instance_eval \"def read; self; end\" # Make the string respond to read\n-\n- generator([destination_root], :builder => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template)\n- capture(:stdout) { generator.invoke_all }\n-\n- DEFAULT_APP_FILES.each{ |path| assert_no_file path }\n+ def builder_class\n+ :AppBuilder\n end\n \n-protected\n-\n def action(*args, &block)\n silence(:stdout){ generator.send(*args, &block) }\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d61a02d32fb98cf08cd4322a406a8a70d4f53c39",
filename = "railties/test/generators/namespaced_generators_test.rb",
status = "modified", additions = 153L, deletions = 0L, changes = 153L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/generators/namespaced_generators_test.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/generators/namespaced_generators_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/generators/namespaced_generators_test.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -3,6 +3,7 @@\n require 'rails/generators/rails/model/model_generator'\n require 'rails/generators/rails/observer/observer_generator'\n require 'rails/generators/mailer/mailer_generator'\n+require 'rails/generators/rails/scaffold/scaffold_generator'\n \n class NamespacedGeneratorTestCase < Rails::Generators::TestCase\n def setup\n@@ -202,3 +203,155 @@ def test_invokes_default_template_engine_even_with_no_action\n assert_file \"app/views/test_app/notifier\"\n end\n end\n+\n+class NamespacedScaffoldGeneratorTest < NamespacedGeneratorTestCase\n+ include GeneratorsTestHelper\n+ arguments %w(product_line title:string price:integer)\n+ tests Rails::Generators::ScaffoldGenerator\n+\n+ setup :copy_routes\n+\n+ def test_scaffold_on_invoke\n+ run_generator\n+\n+ # Model\n+ assert_file \"app/models/test_app/product_line.rb\", /module TestApp\\n class ProductLine < ActiveRecord::Base/\n+ assert_file \"test/unit/test_app/product_line_test.rb\", /module TestApp\\n class ProductLineTest < ActiveSupport::TestCase/\n+ assert_file \"test/fixtures/test_app/product_lines.yml\"\n+ assert_migration \"db/migrate/create_test_app_product_lines.rb\"\n+\n+ # Route\n+ assert_file \"config/routes.rb\" do |route|\n+ assert_match(/resources :product_lines$/, route)\n+ end\n+\n+ # Controller\n+ assert_file \"app/controllers/test_app/product_lines_controller.rb\" do |content|\n+ assert_match(/module TestApp\\n class ProductLinesController < ApplicationController/, content)\n+ end\n+\n+ assert_file \"test/functional/test_app/product_lines_controller_test.rb\",\n+ /module TestApp\\n class ProductLinesControllerTest < ActionController::TestCase/\n+\n+ # Views\n+ %w(\n+ index\n+ edit\n+ new\n+ show\n+ _form\n+ ).each { |view| assert_file \"app/views/test_app/product_lines/#{view}.html.erb\" }\n+ assert_no_file \"app/views/layouts/test_app/product_lines.html.erb\"\n+\n+ # Helpers\n+ assert_file \"app/helpers/test_app/product_lines_helper.rb\"\n+ assert_file \"test/unit/helpers/test_app/product_lines_helper_test.rb\"\n+\n+ # Stylesheets\n+ assert_file \"public/stylesheets/scaffold.css\"\n+ end\n+\n+ def test_scaffold_on_revoke\n+ run_generator\n+ run_generator [\"product_line\"], :behavior => :revoke\n+\n+ # Model\n+ assert_no_file \"app/models/test_app/product_line.rb\"\n+ assert_no_file \"test/unit/test_app/product_line_test.rb\"\n+ assert_no_file \"test/fixtures/test_app/product_lines.yml\"\n+ assert_no_migration \"db/migrate/create_test_app_product_lines.rb\"\n+\n+ # Route\n+ assert_file \"config/routes.rb\" do |route|\n+ assert_no_match(/resources :product_lines$/, route)\n+ end\n+\n+ # Controller\n+ assert_no_file \"app/controllers/test_app/product_lines_controller.rb\"\n+ assert_no_file \"test/functional/test_app/product_lines_controller_test.rb\"\n+\n+ # Views\n+ assert_no_file \"app/views/test_app/product_lines\"\n+ assert_no_file \"app/views/test_app/layouts/product_lines.html.erb\"\n+\n+ # Helpers\n+ assert_no_file \"app/helpers/test_app/product_lines_helper.rb\"\n+ assert_no_file \"test/unit/helpers/test_app/product_lines_helper_test.rb\"\n+\n+ # Stylesheets (should not be removed)\n+ assert_file \"public/stylesheets/scaffold.css\"\n+ end\n+\n+ def test_scaffold_with_namespace_on_invoke\n+ run_generator [ \"admin/role\", \"name:string\", \"description:string\" ]\n+\n+ # Model\n+ assert_file \"app/models/test_app/admin.rb\", /module TestApp\\n module Admin/\n+ assert_file \"app/models/test_app/admin/role.rb\", /module TestApp\\n class Admin::Role < ActiveRecord::Base/\n+ assert_file \"test/unit/test_app/admin/role_test.rb\", /module TestApp\\n class Admin::RoleTest < ActiveSupport::TestCase/\n+ assert_file \"test/fixtures/test_app/admin/roles.yml\"\n+ assert_migration \"db/migrate/create_test_app_admin_roles.rb\"\n+\n+ # Route\n+ assert_file \"config/routes.rb\" do |route|\n+ assert_match(/namespace :admin do resources :roles end$/, route)\n+ end\n+\n+ # Controller\n+ assert_file \"app/controllers/test_app/admin/roles_controller.rb\" do |content|\n+ assert_match(/module TestApp\\n class Admin::RolesController < ApplicationController/, content)\n+ end\n+\n+ assert_file \"test/functional/test_app/admin/roles_controller_test.rb\",\n+ /module TestApp\\n class Admin::RolesControllerTest < ActionController::TestCase/\n+\n+ # Views\n+ %w(\n+ index\n+ edit\n+ new\n+ show\n+ _form\n+ ).each { |view| assert_file \"app/views/test_app/admin/roles/#{view}.html.erb\" }\n+ assert_no_file \"app/views/layouts/admin/roles.html.erb\"\n+\n+ # Helpers\n+ assert_file \"app/helpers/test_app/admin/roles_helper.rb\"\n+ assert_file \"test/unit/helpers/test_app/admin/roles_helper_test.rb\"\n+\n+ # Stylesheets\n+ assert_file \"public/stylesheets/scaffold.css\"\n+ end\n+\n+ def test_scaffold_with_namespace_on_revoke\n+ run_generator [ \"admin/role\", \"name:string\", \"description:string\" ]\n+ run_generator [ \"admin/role\" ], :behavior => :revoke\n+\n+ # Model\n+ assert_file \"app/models/test_app/admin.rb\"\t# ( should not be remove )\n+ assert_no_file \"app/models/test_app/admin/role.rb\"\n+ assert_no_file \"test/unit/test_app/admin/role_test.rb\"\n+ assert_no_file \"test/fixtures/test_app/admin/roles.yml\"\n+ assert_no_migration \"db/migrate/create_test_app_admin_roles.rb\"\n+\n+ # Route\n+ assert_file \"config/routes.rb\" do |route|\n+ assert_no_match(/namespace :admin do resources :roles end$/, route)\n+ end\n+\n+ # Controller\n+ assert_no_file \"app/controllers/test_app/admin/roles_controller.rb\"\n+ assert_no_file \"test/functional/test_app/admin/roles_controller_test.rb\"\n+\n+ # Views\n+ assert_no_file \"app/views/test_app/admin/roles\"\n+ assert_no_file \"app/views/layouts/test_app/admin/roles.html.erb\"\n+\n+ # Helpers\n+ assert_no_file \"app/helpers/test_app/admin/roles_helper.rb\"\n+ assert_no_file \"test/unit/helpers/test_app/admin/roles_helper_test.rb\"\n+\n+ # Stylesheets (should not be removed)\n+ assert_file \"public/stylesheets/scaffold.css\"\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "8dc5ca90bae3fd821b509c303437669ee13f5035",
filename = "railties/test/generators/plugin_new_generator_test.rb",
status = "added", additions = 192L, deletions = 0L, changes = 192L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/generators/plugin_new_generator_test.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/generators/plugin_new_generator_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/generators/plugin_new_generator_test.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,192 @@\n+require 'abstract_unit'\n+require 'generators/generators_test_helper'\n+require 'rails/generators/rails/plugin_new/plugin_new_generator'\n+require 'generators/shared_generator_tests.rb'\n+\n+DEFAULT_PLUGIN_FILES = %w(\n+ .gitignore\n+ Gemfile\n+ Rakefile\n+ bukkits.gemspec\n+ MIT-LICENSE\n+ lib\n+ lib/bukkits.rb\n+ lib/tasks/bukkits_tasks.rake\n+ script/rails\n+ test/bukkits_test.rb\n+ test/test_helper.rb\n+ test/dummy\n+)\n+\n+\n+class PluginNewGeneratorTest < Rails::Generators::TestCase\n+ include GeneratorsTestHelper\n+ destination File.join(Rails.root, \"tmp/bukkits\")\n+ arguments [destination_root]\n+ include SharedGeneratorTests\n+\n+ def default_files\n+ ::DEFAULT_PLUGIN_FILES\n+ end\n+\n+ def test_invalid_plugin_name_raises_an_error\n+ content = capture(:stderr){ run_generator [File.join(destination_root, \"43-things\")] }\n+ assert_equal \"Invalid plugin name 43-things. Please give a name which does not start with numbers.\\n\", content\n+ end\n+\n+ def test_invalid_plugin_name_is_fixed\n+ run_generator [File.join(destination_root, \"things-43\")]\n+ assert_file \"things-43/lib/things-43.rb\", /module Things43/\n+ end\n+\n+ def test_generating_test_files\n+ run_generator\n+ assert_file \"test/test_helper.rb\"\n+ assert_file \"test/bukkits_test.rb\", /assert_kind_of Module, Bukkits/\n+ end\n+\n+ def test_generating_test_files_in_full_mode\n+ run_generator [destination_root, \"--full\"]\n+ assert_directory \"test/integration/\"\n+\n+ assert_file \"test/integration/navigation_test.rb\", /ActionDispatch::IntegrationTest/\n+ end\n+\n+ def test_ensure_that_plugin_options_are_not_passed_to_app_generator\n+ FileUtils.cd(Rails.root)\n+ assert_no_match /It works from file!.*It works_from_file/, run_generator([destination_root, \"-m\", \"lib/template.rb\"])\n+ end\n+\n+ def test_ensure_that_test_dummy_can_be_generated_from_a_template\n+ FileUtils.cd(Rails.root)\n+ run_generator([destination_root, \"-m\", \"lib/create_test_dummy_template.rb\", \"--skip-test-unit\"])\n+ assert_file \"spec/dummy\"\n+ assert_no_file \"test\"\n+ end\n+\n+ def test_database_entry_is_assed_by_default_in_full_mode\n+ run_generator([destination_root, \"--full\"])\n+ assert_file \"test/dummy/config/database.yml\", /sqlite/\n+ assert_file \"Gemfile\", /^gem\\s+[\"']sqlite3-ruby[\"'],\\s+:require\\s+=>\\s+[\"']sqlite3[\"']$/\n+ end\n+\n+ def test_config_another_database\n+ run_generator([destination_root, \"-d\", \"mysql\", \"--full\"])\n+ assert_file \"test/dummy/config/database.yml\", /mysql/\n+ assert_file \"Gemfile\", /^gem\\s+[\"']mysql2[\"']$/\n+ end\n+\n+ def test_active_record_is_removed_from_frameworks_if_skip_active_record_is_given\n+ run_generator [destination_root, \"--skip-active-record\"]\n+ assert_file \"test/dummy/config/application.rb\", /#\\s+require\\s+[\"']active_record\\/railtie[\"']/\n+ end\n+\n+ def test_ensure_that_skip_active_record_option_is_passed_to_app_generator\n+ run_generator [destination_root, \"--skip_active_record\"]\n+ assert_no_file \"test/dummy/config/database.yml\"\n+ assert_no_match /ActiveRecord/, File.read(File.join(destination_root, \"test/test_helper.rb\"))\n+ end\n+\n+ def test_ensure_that_database_option_is_passed_to_app_generator\n+ run_generator [destination_root, \"--database\", \"postgresql\"]\n+ assert_file \"test/dummy/config/database.yml\", /postgres/\n+ end\n+\n+ def test_ensure_that_javascript_option_is_passed_to_app_generator\n+ run_generator [destination_root, \"--javascript\", \"jquery\"]\n+ assert_file \"test/dummy/public/javascripts/jquery.js\"\n+ end\n+\n+ def test_ensure_that_skip_javascript_option_is_passed_to_app_generator\n+ run_generator [destination_root, \"--skip_javascript\"]\n+ assert_no_file \"test/dummy/public/javascripts/prototype.js\"\n+ end\n+\n+ def test_template_from_dir_pwd\n+ FileUtils.cd(Rails.root)\n+ assert_match /It works from file!/, run_generator([destination_root, \"-m\", \"lib/template.rb\"])\n+ end\n+\n+ def test_ensure_that_tests_works\n+ run_generator\n+ FileUtils.cd destination_root\n+ `bundle install`\n+ assert_match /1 tests, 1 assertions, 0 failures, 0 errors/, `bundle exec rake test`\n+ end\n+\n+ def test_ensure_that_tests_works_in_full_mode\n+ run_generator [destination_root, \"--full\"]\n+ FileUtils.cd destination_root\n+ `bundle install`\n+ assert_match /2 tests, 2 assertions, 0 failures, 0 errors/, `bundle exec rake test`\n+ end\n+\n+ def test_creating_engine_in_full_mode\n+ run_generator [destination_root, \"--full\"]\n+ assert_file \"lib/bukkits/engine.rb\", /module Bukkits\\n class Engine < Rails::Engine\\n end\\nend/\n+ assert_file \"lib/bukkits.rb\", /require \"bukkits\\/engine\"/\n+ end\n+\n+ def test_being_quiet_while_creating_dummy_application\n+ assert_no_match /create\\s+config\\/application.rb/, run_generator\n+ end\n+\n+ def test_create_mountable_application_with_mountable_option\n+ run_generator [destination_root, \"--mountable\"]\n+ assert_file \"config/routes.rb\", /Bukkits::Engine.routes.draw do/\n+ assert_file \"lib/bukkits/engine.rb\", /isolate_namespace Bukkits/\n+ assert_file \"test/dummy/config/routes.rb\", /mount Bukkits::Engine => \"\\/bukkits\"/\n+ assert_file \"app/controllers/bukkits/application_controller.rb\", /module Bukkits\\n class ApplicationController < ActiveController::Base/\n+ assert_file \"app/helpers/bukkits/application_helper.rb\", /module Bukkits\\n module ApplicationHelper/\n+ end\n+\n+ def test_passing_dummy_path_as_a_parameter\n+ run_generator [destination_root, \"--dummy_path\", \"spec/dummy\"]\n+ assert_file \"spec/dummy\"\n+ assert_file \"spec/dummy/config/application.rb\"\n+ assert_no_file \"test/dummy\"\n+ end\n+\n+protected\n+\n+ def action(*args, &block)\n+ silence(:stdout){ generator.send(*args, &block) }\n+ end\n+\n+end\n+\n+class CustomPluginGeneratorTest < Rails::Generators::TestCase\n+ include GeneratorsTestHelper\n+ tests Rails::Generators::PluginNewGenerator\n+\n+ destination File.join(Rails.root, \"tmp/bukkits\")\n+ arguments [destination_root]\n+ include SharedCustomGeneratorTests\n+\n+ def test_overriding_test_framework\n+ FileUtils.cd(destination_root)\n+ run_generator([destination_root, \"-b\", \"#{Rails.root}/lib/plugin_builders/spec_builder.rb\"])\n+ assert_file 'spec/spec_helper.rb'\n+ assert_file 'spec/dummy'\n+ assert_file 'Rakefile', /task :default => :spec/\n+ assert_file 'Rakefile', /# spec tasks in rakefile/\n+ assert_file 'script/rails', %r{spec/dummy}\n+ end\n+\n+protected\n+ def default_files\n+ ::DEFAULT_PLUGIN_FILES\n+ end\n+\n+ def builder_class\n+ :PluginBuilder\n+ end\n+\n+ def builders_dir\n+ \"plugin_builders\"\n+ end\n+\n+ def action(*args, &block)\n+ silence(:stdout){ generator.send(*args, &block) }\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d117656fbdfa48b64525f768126a0e0ba32cc68f",
filename = "railties/test/generators/shared_generator_tests.rb",
status = "added", additions = 187L, deletions = 0L, changes = 187L,
blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/generators/shared_generator_tests.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/generators/shared_generator_tests.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/generators/shared_generator_tests.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -0,0 +1,187 @@\n+module SharedGeneratorTests\n+ def setup\n+ Rails.application = TestApp::Application\n+ super\n+ Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)\n+ @bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle')\n+\n+ Kernel::silence_warnings do\n+ Thor::Base.shell.send(:attr_accessor, :always_force)\n+ @shell = Thor::Base.shell.new\n+ @shell.send(:always_force=, true)\n+ end\n+ end\n+\n+ def teardown\n+ super\n+ Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)\n+ Rails.application = TestApp::Application.instance\n+ end\n+\n+ def test_skeleton_is_created\n+ run_generator\n+\n+ default_files.each{ |path| assert_file path }\n+ end\n+\n+ def test_plugin_new_generate_pretend\n+ run_generator [\"testapp\", \"--pretend\"]\n+\n+ default_files.each{ |path| assert_no_file path }\n+ end\n+\n+ def test_invalid_database_option_raises_an_error\n+ content = capture(:stderr){ run_generator([destination_root, \"-d\", \"unknown\"]) }\n+ assert_match /Invalid value for \\-\\-database option/, content\n+ end\n+\n+ def test_test_unit_is_skipped_if_required\n+ run_generator [destination_root, \"--skip-test-unit\"]\n+ assert_no_file \"test\"\n+ end\n+\n+ def test_options_before_application_name_raises_an_error\n+ content = capture(:stderr){ run_generator([\"--pretend\", destination_root]) }\n+ assert_match /Options should be given after the \\w+ name. For details run: rails( plugin)? --help\\n/, content\n+ end\n+\n+ def test_name_collision_raises_an_error\n+ reserved_words = %w[application destroy plugin runner test]\n+ reserved_words.each do |reserved|\n+ content = capture(:stderr){ run_generator [File.join(destination_root, reserved)] }\n+ assert_match /Invalid \\w+ name #{reserved}. Please give a name which does not match one of the reserved rails words.\\n/, content\n+ end\n+ end\n+\n+ def test_name_raises_an_error_if_name_already_used_constant\n+ %w{ String Hash Class Module Set Symbol }.each do |ruby_class|\n+ content = capture(:stderr){ run_generator [File.join(destination_root, ruby_class)] }\n+ assert_match /Invalid \\w+ name #{ruby_class}, constant #{ruby_class} is already in use. Please choose another \\w+ name.\\n/, content\n+ end\n+ end\n+\n+ def test_shebang_is_added_to_rails_file\n+ run_generator [destination_root, \"--ruby\", \"foo/bar/baz\"]\n+ assert_file \"script/rails\", /#!foo\\/bar\\/baz/\n+ end\n+\n+ def test_shebang_when_is_the_same_as_default_use_env\n+ run_generator [destination_root, \"--ruby\", Thor::Util.ruby_command]\n+ assert_file \"script/rails\", /#!\\/usr\\/bin\\/env/\n+ end\n+\n+ def test_template_raises_an_error_with_invalid_path\n+ content = capture(:stderr){ run_generator([destination_root, \"-m\", \"non/existant/path\"]) }\n+ assert_match /The template \\[.*\\] could not be loaded/, content\n+ assert_match /non\\/existant\\/path/, content\n+ end\n+\n+ def test_template_is_executed_when_supplied\n+ path = \"http://gist.github.com/103208.txt\"\n+ template = %{ say \"It works!\" }\n+ template.instance_eval \"def read; self; end\" # Make the string respond to read\n+\n+ generator([destination_root], :template => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template)\n+ assert_match /It works!/, silence(:stdout){ generator.invoke_all }\n+ end\n+\n+ def test_dev_option\n+ generator([destination_root], :dev => true).expects(:run).with(\"#{@bundle_command} install\")\n+ silence(:stdout){ generator.invoke_all }\n+ rails_path = File.expand_path('../../..', Rails.root)\n+ assert_file 'Gemfile', /^gem\\s+[\"']rails[\"'],\\s+:path\\s+=>\\s+[\"']#{Regexp.escape(rails_path)}[\"']$/\n+ end\n+\n+ def test_edge_option\n+ generator([destination_root], :edge => true).expects(:run).with(\"#{@bundle_command} install\")\n+ silence(:stdout){ generator.invoke_all }\n+ assert_file 'Gemfile', %r{^gem\\s+[\"']rails[\"'],\\s+:git\\s+=>\\s+[\"']#{Regexp.escape(\"git://github.com/rails/rails.git\")}[\"']$}\n+ end\n+\n+ def test_template_raises_an_error_with_invalid_path\n+ content = capture(:stderr){ run_generator([destination_root, \"-m\", \"non/existant/path\"]) }\n+ assert_match /The template \\[.*\\] could not be loaded/, content\n+ assert_match /non\\/existant\\/path/, content\n+ end\n+\n+ def test_template_is_executed_when_supplied\n+ path = \"http://gist.github.com/103208.txt\"\n+ template = %{ say \"It works!\" }\n+ template.instance_eval \"def read; self; end\" # Make the string respond to read\n+\n+ generator([destination_root], :template => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template)\n+ assert_match /It works!/, silence(:stdout){ generator.invoke_all }\n+ end\n+\n+ def test_dev_option\n+ generator([destination_root], :dev => true).expects(:run).with(\"#{@bundle_command} install\")\n+ silence(:stdout){ generator.invoke_all }\n+ rails_path = File.expand_path('../../..', Rails.root)\n+ assert_file 'Gemfile', /^gem\\s+[\"']rails[\"'],\\s+:path\\s+=>\\s+[\"']#{Regexp.escape(rails_path)}[\"']$/\n+ end\n+\n+ def test_edge_option\n+ generator([destination_root], :edge => true).expects(:run).with(\"#{@bundle_command} install\")\n+ silence(:stdout){ generator.invoke_all }\n+ assert_file 'Gemfile', %r{^gem\\s+[\"']rails[\"'],\\s+:git\\s+=>\\s+[\"']#{Regexp.escape(\"git://github.com/rails/rails.git\")}[\"']$}\n+ end\n+end\n+\n+module SharedCustomGeneratorTests\n+ def setup\n+ Rails.application = TestApp::Application\n+ super\n+ Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)\n+ @bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle')\n+ end\n+\n+ def teardown\n+ super\n+ Rails::Generators::AppGenerator.instance_variable_set('@desc', nil)\n+ Object.class_eval do\n+ remove_const :AppBuilder if const_defined?(:AppBuilder)\n+ remove_const :PluginBuilder if const_defined?(:PluginBuilder)\n+ end\n+ Rails.application = TestApp::Application.instance\n+ end\n+\n+ def test_builder_option_with_empty_app_builder\n+ FileUtils.cd(destination_root)\n+ run_generator([destination_root, \"-b\", \"#{Rails.root}/lib/#{builders_dir}/empty_builder.rb\"])\n+ default_files.each{ |path| assert_no_file path }\n+ end\n+\n+ def test_builder_option_with_simple_plugin_builder\n+ FileUtils.cd(destination_root)\n+ run_generator([destination_root, \"-b\", \"#{Rails.root}/lib/#{builders_dir}/simple_builder.rb\"])\n+ (default_files - ['.gitignore']).each{ |path| assert_no_file path }\n+ assert_file \".gitignore\", \"foobar\"\n+ end\n+\n+ def test_builder_option_with_relative_path\n+ here = File.expand_path(File.dirname(__FILE__))\n+ FileUtils.cd(here)\n+ run_generator([destination_root, \"-b\", \"../fixtures/lib/#{builders_dir}/simple_builder.rb\"])\n+ FileUtils.cd(destination_root)\n+ (default_files - ['.gitignore']).each{ |path| assert_no_file path }\n+ assert_file \".gitignore\", \"foobar\"\n+ end\n+\n+ def test_builder_option_with_tweak_plugin_builder\n+ FileUtils.cd(destination_root)\n+ run_generator([destination_root, \"-b\", \"#{Rails.root}/lib/#{builders_dir}/tweak_builder.rb\"])\n+ default_files.each{ |path| assert_file path }\n+ assert_file \".gitignore\", \"foobar\"\n+ end\n+\n+ def test_builder_option_with_http\n+ path = \"http://gist.github.com/103208.txt\"\n+ template = \"class #{builder_class}; end\"\n+ template.instance_eval \"def read; self; end\" # Make the string respond to read\n+\n+ generator([destination_root], :builder => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template)\n+ capture(:stdout) { generator.invoke_all }\n+\n+ default_files.each{ |path| assert_no_file path }\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "822be24ef1bceea7487a9b6f22bd1a791a655ad3",
filename = "railties/test/railties/engine_test.rb", status = "modified",
additions = 20L, deletions = 0L, changes = 20L, blob_url = "https://github.com/rails/rails/blob/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/railties/engine_test.rb",
raw_url = "https://github.com/rails/rails/raw/cc135e3b6df1785852de2470b4b93559c88c891e/railties/test/railties/engine_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/railties/engine_test.rb?ref=cc135e3b6df1785852de2470b4b93559c88c891e",
patch = "@@ -685,5 +685,25 @@ class Engine < ::Rails::Engine\n assert_equal :haml , generators[:template_engine]\n assert_equal :rspec , generators[:test_framework]\n end\n+\n+ test \"engine should get default generators with ability to overwrite them\" do\n+ @plugin.write \"lib/bukkits.rb\", <<-RUBY\n+ module Bukkits\n+ class Engine < ::Rails::Engine\n+ config.generators.test_framework :rspec\n+ end\n+ end\n+ RUBY\n+\n+ boot_rails\n+ require \"#{rails_root}/config/environment\"\n+\n+ generators = Bukkits::Engine.config.generators.options[:rails]\n+ assert_equal :active_record, generators[:orm]\n+ assert_equal :rspec , generators[:test_framework]\n+\n+ app_generators = Rails.application.config.generators.options[:rails]\n+ assert_equal :test_unit , app_generators[:test_framework]\n+ end\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:50 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 12:00:46 GMT",
etag = "\"fab27acc7abf6b88c394e10940d198b1\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248254:54D9023E",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "065b43cd9674091fec48a221b420fbb3"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "9d05c7e6ee1f75f34fe9f63a267776a6794e6111", filename = "actionpack/lib/action_dispatch/http/mime_negotiation.rb",
status = "modified", additions = 7L, deletions = 3L, changes = 10L,
blob_url = "https://github.com/rails/rails/blob/153ea94ada1895ae5ac89955c9aa6a9bd1f9eb17/actionpack/lib/action_dispatch/http/mime_negotiation.rb",
raw_url = "https://github.com/rails/rails/raw/153ea94ada1895ae5ac89955c9aa6a9bd1f9eb17/actionpack/lib/action_dispatch/http/mime_negotiation.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_dispatch/http/mime_negotiation.rb?ref=153ea94ada1895ae5ac89955c9aa6a9bd1f9eb17",
patch = "@@ -22,10 +22,14 @@ def content_type\n # Returns the accepted MIME type for the request.\n def accepts\n @env[\"action_dispatch.request.accepts\"] ||= begin\n- header = @env['HTTP_ACCEPT'].to_s.strip\n+ header = @env['HTTP_ACCEPT']\n \n- if header.empty?\n- [content_mime_type]\n+ if header.blank?\n+ if xhr?\n+ [content_mime_type]\n+ else\n+ ['*/*']# Mime::ALL\n+ end\n else\n Mime::Type.parse(header)\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:50 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Sun, 08 Feb 2015 12:59:15 GMT",
etag = "\"113435674dd95556fdc93f2bdb82d9ac\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24827B:54D9023E",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "139317cebd6caf9cd03889139437f00b"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "82134a06d40c6934bd44f2c3b4ad2cd4c262d624", filename = "activerecord/CHANGELOG",
status = "modified", additions = 8L, deletions = 1L, changes = 9L,
blob_url = "https://github.com/rails/rails/blob/23613eb6fe1064d80eba9db59e1e4f9e4bbb4e1b/activerecord/CHANGELOG",
raw_url = "https://github.com/rails/rails/raw/23613eb6fe1064d80eba9db59e1e4f9e4bbb4e1b/activerecord/CHANGELOG",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/CHANGELOG?ref=23613eb6fe1064d80eba9db59e1e4f9e4bbb4e1b",
patch = "@@ -45,7 +45,14 @@ IrreversibleMigration exception will be raised when going down.\n \n [Aaron Patterson]\n \n-*Rails 3.0.2 (unreleased)*\n+*Rails 3.0.3 (November 16, 2010)*\n+\n+* Support find by class like this: Post.where(:name => Post)\n+\n+\n+*Rails 3.0.2 (November 15, 2010)*\n+\n+* Dramatic speed increase (see: http://engineering.attinteractive.com/2010/10/arel-two-point-ohhhhh-yaaaaaa/) [Aaron Patterson]\n \n * reorder is deprecated in favor of except(:order).order(...) [Santiago Pastorino]\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:50 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 18:28:37 GMT",
etag = "\"bbb6b6053ff9ba3098f91c8e9ef10c89\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24829D:54D9023E",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "474556b853193c38f1b14328ce2d1b7d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "5eb1071ba2df7a152d1bad661203e364e42cf891", filename = "activerecord/lib/active_record/association_preload.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d/activerecord/lib/active_record/association_preload.rb",
raw_url = "https://github.com/rails/rails/raw/30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d/activerecord/lib/active_record/association_preload.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/association_preload.rb?ref=30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d",
patch = "@@ -391,9 +391,9 @@ def in_or_equals_for_ids(ids)\n # Some databases impose a limit on the number of ids in a list (in Oracle its 1000)\n # Make several smaller queries if necessary or make one query if the adapter supports it\n def associated_records(ids)\n- max_ids_in_a_list = connection.ids_in_list_limit || ids.size\n+ in_clause_length = connection.in_clause_length || ids.size\n records = []\n- ids.each_slice(max_ids_in_a_list) do |some_ids|\n+ ids.each_slice(in_clause_length) do |some_ids|\n records += yield(some_ids)\n end\n records"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "29ac9341ecf3216888f6a813ed90a9fe4ffd6436",
filename = "activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb",
raw_url = "https://github.com/rails/rails/raw/30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb?ref=30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d",
patch = "@@ -37,9 +37,9 @@ def columns_per_multicolumn_index\n 16\n end\n \n- # the maximum number of elements in an IN (x,y,z) clause\n+ # the maximum number of elements in an IN (x,y,z) clause. nil means no limit\n def in_clause_length\n- 65535\n+ nil\n end\n \n # the maximum length of an SQL query"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "f3fba9a3a96d9f05858fdfdd08f4e8d756c2939c",
filename = "activerecord/lib/active_record/connection_adapters/abstract_adapter.rb",
status = "modified", additions = 0L, deletions = 5L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb",
raw_url = "https://github.com/rails/rails/raw/30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb?ref=30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d",
patch = "@@ -91,11 +91,6 @@ def prefetch_primary_key?(table_name = nil)\n false\n end\n \n- # Does this adapter restrict the number of ids you can use in a list. Oracle has a limit of 1000.\n- def ids_in_list_limit\n- nil\n- end\n-\n # QUOTING ==================================================\n \n # Override to return the quoted table name. Defaults to column quoting."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ea86ac29d07cb8b361226a42d4bffe4a56f62e35",
filename = "activerecord/test/cases/associations/eager_test.rb",
status = "modified", additions = 7L, deletions = 7L, changes = 14L,
blob_url = "https://github.com/rails/rails/blob/30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d/activerecord/test/cases/associations/eager_test.rb",
raw_url = "https://github.com/rails/rails/raw/30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d/activerecord/test/cases/associations/eager_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/associations/eager_test.rb?ref=30cf3cc8dbc6a920ae24a88f7cf59d55656a8e1d",
patch = "@@ -80,31 +80,31 @@ def test_duplicate_middle_objects\n end\n \n def test_preloading_has_many_in_multiple_queries_with_more_ids_than_database_can_handle\n- Post.connection.expects(:ids_in_list_limit).at_least_once.returns(5)\n+ Post.connection.expects(:in_clause_length).at_least_once.returns(5)\n posts = Post.find(:all, :include=>:comments)\n assert_equal 7, posts.size\n end\n \n def test_preloading_has_many_in_one_queries_when_database_has_no_limit_on_ids_it_can_handle\n- Post.connection.expects(:ids_in_list_limit).at_least_once.returns(nil)\n+ Post.connection.expects(:in_clause_length).at_least_once.returns(nil)\n posts = Post.find(:all, :include=>:comments)\n assert_equal 7, posts.size\n end\n \n def test_preloading_habtm_in_multiple_queries_with_more_ids_than_database_can_handle\n- Post.connection.expects(:ids_in_list_limit).at_least_once.returns(5)\n+ Post.connection.expects(:in_clause_length).at_least_once.returns(5)\n posts = Post.find(:all, :include=>:categories)\n assert_equal 7, posts.size\n end\n \n def test_preloading_habtm_in_one_queries_when_database_has_no_limit_on_ids_it_can_handle\n- Post.connection.expects(:ids_in_list_limit).at_least_once.returns(nil)\n+ Post.connection.expects(:in_clause_length).at_least_once.returns(nil)\n posts = Post.find(:all, :include=>:categories)\n assert_equal 7, posts.size\n end\n \n def test_load_associated_records_in_one_query_when_adapter_has_no_limit\n- Post.connection.expects(:ids_in_list_limit).at_least_once.returns(nil)\n+ Post.connection.expects(:in_clause_length).at_least_once.returns(nil)\n Post.expects(:i_was_called).with([1,2,3,4,5,6,7]).returns([1])\n associated_records = Post.send(:associated_records, [1,2,3,4,5,6,7]) do |some_ids|\n Post.i_was_called(some_ids)\n@@ -113,7 +113,7 @@ def test_load_associated_records_in_one_query_when_adapter_has_no_limit\n end\n \n def test_load_associated_records_in_several_queries_when_many_ids_passed\n- Post.connection.expects(:ids_in_list_limit).at_least_once.returns(5)\n+ Post.connection.expects(:in_clause_length).at_least_once.returns(5)\n Post.expects(:i_was_called).with([1,2,3,4,5]).returns([1])\n Post.expects(:i_was_called).with([6,7]).returns([6])\n associated_records = Post.send(:associated_records, [1,2,3,4,5,6,7]) do |some_ids|\n@@ -123,7 +123,7 @@ def test_load_associated_records_in_several_queries_when_many_ids_passed\n end\n \n def test_load_associated_records_in_one_query_when_a_few_ids_passed\n- Post.connection.expects(:ids_in_list_limit).at_least_once.returns(5)\n+ Post.connection.expects(:in_clause_length).at_least_once.returns(5)\n Post.expects(:i_was_called).with([1,2,3]).returns([1])\n associated_records = Post.send(:associated_records, [1,2,3]) do |some_ids|\n Post.i_was_called(some_ids)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:50 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Fri, 06 Feb 2015 00:49:15 GMT",
etag = "\"12bfef8ab49af5b2a2267f4e11c882c0\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2482BA:54D9023E",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "76d9828c7e4f1d910f7ba069e90ce976"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "1f3c770c77b7a32efd73bcdc44bda5a59c85b8c5", filename = "Rakefile",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c",
patch = "@@ -1,7 +1,7 @@\n+#!/usr/bin/env rake\n gem 'rdoc', '>= 2.5.10'\n require 'rdoc'\n \n-require 'rake'\n require 'rdoc/task'\n require 'net/http'\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "123ef9bbbf7617ced4e83711b79e9bf8bc070b9c",
filename = "actionmailer/Rakefile", status = "modified",
additions = 1L, deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/actionmailer/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/actionmailer/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionmailer/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c",
patch = "@@ -1,4 +1,4 @@\n-require 'rake'\n+#!/usr/bin/env rake\n require 'rake/testtask'\n require 'rake/packagetask'\n require 'rake/gempackagetask'"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "9030db9f7a7dc63e568f7c30c86c0f7ef0d638f4",
filename = "actionpack/Rakefile", status = "modified", additions = 1L,
deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/actionpack/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/actionpack/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c",
patch = "@@ -1,4 +1,4 @@\n-require 'rake'\n+#!/usr/bin/env rake\n require 'rake/testtask'\n require 'rake/packagetask'\n require 'rake/gempackagetask'"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = NULL,
filename = "activemodel/Rakefile", status = "changed", additions = 0L,
deletions = 0L, changes = 0L, blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/activemodel/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/activemodel/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url")), structure(list(sha = "f9b77c1799c308a2893735c27033a7b839a1ace4",
filename = "activerecord/Rakefile", status = "modified",
additions = 1L, deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/activerecord/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/activerecord/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c",
patch = "@@ -1,4 +1,4 @@\n-require 'rake'\n+#!/usr/bin/env rake\n require 'rake/testtask'\n require 'rake/packagetask'\n require 'rake/gempackagetask'"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "cf01bc1389f6dbd11912c36a89626a7658e68c23",
filename = "activeresource/Rakefile", status = "modified",
additions = 1L, deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/activeresource/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/activeresource/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c",
patch = "@@ -1,4 +1,4 @@\n-require 'rake'\n+#!/usr/bin/env rake\n require 'rake/testtask'\n require 'rake/packagetask'\n require 'rake/gempackagetask'"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = NULL,
filename = "activesupport/Rakefile", status = "changed",
additions = 0L, deletions = 0L, changes = 0L, blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/activesupport/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/activesupport/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url")), structure(list(sha = "5137bee761ef83b41412da1ebf4c3282adb74ca5",
filename = "railties/Rakefile", status = "modified", additions = 1L,
deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/railties/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/railties/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c",
patch = "@@ -1,4 +1,4 @@\n-require 'rake'\n+#!/usr/bin/env rake\n require 'rake/testtask'\n require 'rake/gempackagetask'\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "4dc1023f1f3eacf04735f2c1bba46b5969fc3465",
filename = "railties/lib/rails/generators/rails/app/templates/Rakefile",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/railties/lib/rails/generators/rails/app/templates/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/railties/lib/rails/generators/rails/app/templates/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c",
patch = "@@ -1,7 +1,7 @@\n+#!/usr/bin/env rake\n # Add your own tasks in files placed in lib/tasks ending in .rake,\n # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.\n \n require File.expand_path('../config/application', __FILE__)\n-require 'rake'\n \n <%= app_const %>.load_tasks"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "77149ae3519986b3841e332f80d51d8cddbad377",
filename = "railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c",
patch = "@@ -1,4 +1,4 @@\n-require 'rake'\n+#!/usr/bin/env rake\n require 'rake/testtask'\n require 'rake/rdoctask'\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "12350309bfd3a6e24c47222232c7a09b7f7c2584",
filename = "railties/lib/rails/generators/rails/plugin_new/templates/Rakefile",
status = "modified", additions = 1L, deletions = 3L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/a6dbd4b26f43528a52466b935acd1bc03708eb6c/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile",
raw_url = "https://github.com/rails/rails/raw/a6dbd4b26f43528a52466b935acd1bc03708eb6c/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile?ref=a6dbd4b26f43528a52466b935acd1bc03708eb6c",
patch = "@@ -1,12 +1,10 @@\n-# encoding: UTF-8\n-require 'rubygems'\n+#!/usr/bin/env rake\n begin\n require 'bundler/setup'\n rescue LoadError\n puts 'You must `gem install bundler` and `bundle install` to run rake tasks'\n end\n \n-require 'rake'\n require 'rake/rdoctask'\n \n Rake::RDocTask.new(:rdoc) do |rdoc|"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:50 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Sun, 08 Feb 2015 06:27:10 GMT",
etag = "\"b264220a32f857b7dcdf5988b27ac3e7\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2482D5:54D9023E",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "139317cebd6caf9cd03889139437f00b"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "a4b1aa715482d18d9fe0312ba6fdaf7a3258879e", filename = "activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb",
status = "modified", additions = 7L, deletions = 6L, changes = 13L,
blob_url = "https://github.com/rails/rails/blob/16d7ba0698ef28efab31940ba4d3aed237814c7e/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb",
raw_url = "https://github.com/rails/rails/raw/16d7ba0698ef28efab31940ba4d3aed237814c7e/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb?ref=16d7ba0698ef28efab31940ba4d3aed237814c7e",
patch = "@@ -404,10 +404,7 @@ def session_auth=(user)\n # REFERENTIAL INTEGRITY ====================================\n \n def supports_disable_referential_integrity?() #:nodoc:\n- version = query(\"SHOW server_version\")[0][0].split('.')\n- version[0].to_i >= 8 && version[1].to_i >= 1\n- rescue\n- return false\n+ postgresql_version >= 80100\n end\n \n def disable_referential_integrity #:nodoc:\n@@ -956,8 +953,12 @@ def postgresql_version\n else\n # Mimic PGconn.server_version behavior\n begin\n- query('SELECT version()')[0][0] =~ /PostgreSQL (\\d+)\\.(\\d+)\\.(\\d+)/\n- ($1.to_i * 10000) + ($2.to_i * 100) + $3.to_i\n+ if query('SELECT version()')[0][0] =~ /PostgreSQL ([0-9.]+)/\n+ major, minor, tiny = $1.split(\".\")\n+ (major.to_i * 10000) + (minor.to_i * 100) + tiny.to_i\n+ else\n+ 0\n+ end\n rescue\n 0\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:51 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:18:15 GMT",
etag = "\"2ad1012d42e7cc892fcb5a50504d411b\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2482F9:54D9023E",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "474556b853193c38f1b14328ce2d1b7d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "f0e6514974725c2411ee133ed6ea5c36bfecbf11", filename = "activesupport/lib/active_support/callbacks.rb",
status = "modified", additions = 50L, deletions = 56L, changes = 106L,
blob_url = "https://github.com/rails/rails/blob/5f89e075223dd7f14b8974fc2d6b27671296ef00/activesupport/lib/active_support/callbacks.rb",
raw_url = "https://github.com/rails/rails/raw/5f89e075223dd7f14b8974fc2d6b27671296ef00/activesupport/lib/active_support/callbacks.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/lib/active_support/callbacks.rb?ref=5f89e075223dd7f14b8974fc2d6b27671296ef00",
patch = "@@ -178,49 +178,48 @@ def start(key=nil, object=nil)\n # options[0] is the compiled form of supplied conditions\n # options[1] is the \"end\" for the conditional\n #\n- if @kind == :before || @kind == :around\n- if @kind == :before\n- # if condition # before_save :filter_name, :if => :condition\n- # filter_name\n- # end\n- filter = <<-RUBY_EVAL\n- unless halted\n- result = #{@filter}\n- halted = (#{chain.config[:terminator]})\n- end\n- RUBY_EVAL\n-\n- [@compiled_options[0], filter, @compiled_options[1]].compact.join(\"\\n\")\n- else\n- # Compile around filters with conditions into proxy methods\n- # that contain the conditions.\n- #\n- # For `around_save :filter_name, :if => :condition':\n- #\n- # def _conditional_callback_save_17\n- # if condition\n- # filter_name do\n- # yield self\n- # end\n- # else\n- # yield self\n- # end\n- # end\n- #\n- name = \"_conditional_callback_#{@kind}_#{next_id}\"\n- @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1\n- def #{name}(halted)\n- #{@compiled_options[0] || \"if true\"} && !halted\n- #{@filter} do\n- yield self\n- end\n- else\n+ case @kind\n+ when :before\n+ # if condition # before_save :filter_name, :if => :condition\n+ # filter_name\n+ # end\n+ filter = <<-RUBY_EVAL\n+ unless halted\n+ result = #{@filter}\n+ halted = (#{chain.config[:terminator]})\n+ end\n+ RUBY_EVAL\n+\n+ [@compiled_options[0], filter, @compiled_options[1]].compact.join(\"\\n\")\n+ when :around\n+ # Compile around filters with conditions into proxy methods\n+ # that contain the conditions.\n+ #\n+ # For `around_save :filter_name, :if => :condition':\n+ #\n+ # def _conditional_callback_save_17\n+ # if condition\n+ # filter_name do\n+ # yield self\n+ # end\n+ # else\n+ # yield self\n+ # end\n+ # end\n+ #\n+ name = \"_conditional_callback_#{@kind}_#{next_id}\"\n+ @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1\n+ def #{name}(halted)\n+ #{@compiled_options[0] || \"if true\"} && !halted\n+ #{@filter} do\n yield self\n end\n+ else\n+ yield self\n end\n- RUBY_EVAL\n- \"#{name}(halted) do\"\n- end\n+ end\n+ RUBY_EVAL\n+ \"#{name}(halted) do\"\n end\n end\n \n@@ -229,15 +228,14 @@ def #{name}(halted)\n def end(key=nil, object=nil)\n return if key && !object.send(\"_one_time_conditions_valid_#{@callback_id}?\")\n \n- if @kind == :around || @kind == :after\n+ case @kind\n+ when :after\n # if condition # after_save :filter_name, :if => :condition\n # filter_name\n # end\n- if @kind == :after\n- [@compiled_options[0], @filter, @compiled_options[1]].compact.join(\"\\n\")\n- else\n- \"end\"\n- end\n+ [@compiled_options[0], @filter, @compiled_options[1]].compact.join(\"\\n\")\n+ when :around\n+ \"end\"\n end\n end\n \n@@ -388,7 +386,7 @@ module ClassMethods\n # key. See #define_callbacks for more information.\n #\n def __define_runner(symbol) #:nodoc:\n- body = send(\"_#{symbol}_callbacks\").compile(nil)\n+ body = send(\"_#{symbol}_callbacks\").compile\n \n silence_warnings do\n undef_method \"_run_#{symbol}_callbacks\" if method_defined?(\"_run_#{symbol}_callbacks\")\n@@ -416,15 +414,11 @@ def _run_#{symbol}_callbacks(key = nil, &blk)\n # which callbacks can be omitted because of per_key conditions.\n #\n def __create_keyed_callback(name, kind, object, &blk) #:nodoc:\n- @_keyed_callbacks ||= {}\n- @_keyed_callbacks[name] ||= begin\n- str = send(\"_#{kind}_callbacks\").compile(name, object)\n- class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1\n- def #{name}() #{str} end\n- protected :#{name}\n- RUBY_EVAL\n- true\n- end\n+ method_body = send(\"_#{kind}_callbacks\").compile(name, object)\n+ class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1\n+ def #{name}() #{method_body} end\n+ protected :#{name}\n+ RUBY_EVAL\n end\n \n # This is used internally to append, prepend and skip callbacks to the"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:51 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 15:04:10 GMT",
etag = "\"7250f7ef40e420f9892837ed217612df\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248318:54D9023F",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "a30e6f9aa7cf5731b87dfb3b9992202d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "0920897b4acbbf05b283f10db4e7cc63b9b00e18", filename = "actionpack/lib/action_view/helpers/form_options_helper.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/394cdfdc24575eac06551d24ea5978c834b2833d/actionpack/lib/action_view/helpers/form_options_helper.rb",
raw_url = "https://github.com/rails/rails/raw/394cdfdc24575eac06551d24ea5978c834b2833d/actionpack/lib/action_view/helpers/form_options_helper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_view/helpers/form_options_helper.rb?ref=394cdfdc24575eac06551d24ea5978c834b2833d",
patch = "@@ -534,7 +534,7 @@ def extract_selected_and_disabled(selected)\n else\n selected = Array.wrap(selected)\n options = selected.extract_options!.symbolize_keys\n- [ options[:selected] || selected , options[:disabled] ]\n+ [ options.include?(:selected) ? options[:selected] : selected, options[:disabled] ]\n end\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "69b1d4ff7bda46dbfa1e380af3cc88bca65ad585",
filename = "actionpack/test/template/form_options_helper_test.rb",
status = "modified", additions = 24L, deletions = 8L, changes = 32L,
blob_url = "https://github.com/rails/rails/blob/394cdfdc24575eac06551d24ea5978c834b2833d/actionpack/test/template/form_options_helper_test.rb",
raw_url = "https://github.com/rails/rails/raw/394cdfdc24575eac06551d24ea5978c834b2833d/actionpack/test/template/form_options_helper_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/template/form_options_helper_test.rb?ref=394cdfdc24575eac06551d24ea5978c834b2833d",
patch = "@@ -7,7 +7,7 @@ class FormOptionsHelperTest < ActionView::TestCase\n tests ActionView::Helpers::FormOptionsHelper\n \n silence_warnings do\n- Post = Struct.new('Post', :title, :author_name, :body, :secret, :written_on, :category, :origin)\n+ Post = Struct.new('Post', :title, :author_name, :body, :secret, :written_on, :category, :origin, :allow_comments)\n Continent = Struct.new('Continent', :continent_name, :countries)\n Country = Struct.new('Country', :country_id, :country_name)\n Firm = Struct.new('Firm', :time_zone)\n@@ -130,6 +130,13 @@ def test_array_options_for_select_with_selection_and_disabled_value\n )\n end\n \n+ def test_boolean_array_options_for_select_with_selection_and_disabled_value\n+ assert_dom_equal(\n+ \"<option value=\\\"true\\\">true</option>\\n<option value=\\\"false\\\" selected=\\\"selected\\\">false</option>\",\n+ options_for_select([ true, false ], :selected => false, :disabled => nil)\n+ )\n+ end\n+\n def test_array_options_for_string_include_in_other_string_bug_fix\n assert_dom_equal(\n \"<option value=\\\"ruby\\\">ruby</option>\\n<option value=\\\"rubyonrails\\\" selected=\\\"selected\\\">rubyonrails</option>\",\n@@ -177,7 +184,7 @@ def test_ducktyped_options_for_select\n end\n \n def test_collection_options_with_preselected_value_as_string_and_option_value_is_integer\n- albums = [ Album.new(1, \"first\",\"rap\"), Album.new(2, \"second\",\"pop\")] \n+ albums = [ Album.new(1, \"first\",\"rap\"), Album.new(2, \"second\",\"pop\")]\n assert_dom_equal(\n %(<option selected=\"selected\" value=\"1\">rap</option>\\n<option value=\"2\">pop</option>),\n options_from_collection_for_select(albums, \"id\", \"genre\", :selected => \"1\")\n@@ -185,7 +192,7 @@ def test_collection_options_with_preselected_value_as_string_and_option_value_is\n end\n \n def test_collection_options_with_preselected_value_as_integer_and_option_value_is_string\n- albums = [ Album.new(\"1\", \"first\",\"rap\"), Album.new(\"2\", \"second\",\"pop\")] \n+ albums = [ Album.new(\"1\", \"first\",\"rap\"), Album.new(\"2\", \"second\",\"pop\")]\n \n assert_dom_equal(\n %(<option selected=\"selected\" value=\"1\">rap</option>\\n<option value=\"2\">pop</option>),\n@@ -194,7 +201,7 @@ def test_collection_options_with_preselected_value_as_integer_and_option_value_i\n end\n \n def test_collection_options_with_preselected_value_as_string_and_option_value_is_float\n- albums = [ Album.new(1.0, \"first\",\"rap\"), Album.new(2.0, \"second\",\"pop\")] \n+ albums = [ Album.new(1.0, \"first\",\"rap\"), Album.new(2.0, \"second\",\"pop\")]\n \n assert_dom_equal(\n %(<option value=\"1.0\">rap</option>\\n<option value=\"2.0\" selected=\"selected\">pop</option>),\n@@ -203,7 +210,7 @@ def test_collection_options_with_preselected_value_as_string_and_option_value_is\n end\n \n def test_collection_options_with_preselected_value_as_nil\n- albums = [ Album.new(1.0, \"first\",\"rap\"), Album.new(2.0, \"second\",\"pop\")] \n+ albums = [ Album.new(1.0, \"first\",\"rap\"), Album.new(2.0, \"second\",\"pop\")]\n \n assert_dom_equal(\n %(<option value=\"1.0\">rap</option>\\n<option value=\"2.0\">pop</option>),\n@@ -212,7 +219,7 @@ def test_collection_options_with_preselected_value_as_nil\n end\n \n def test_collection_options_with_disabled_value_as_nil\n- albums = [ Album.new(1.0, \"first\",\"rap\"), Album.new(2.0, \"second\",\"pop\")] \n+ albums = [ Album.new(1.0, \"first\",\"rap\"), Album.new(2.0, \"second\",\"pop\")]\n \n assert_dom_equal(\n %(<option value=\"1.0\">rap</option>\\n<option value=\"2.0\">pop</option>),\n@@ -221,7 +228,7 @@ def test_collection_options_with_disabled_value_as_nil\n end\n \n def test_collection_options_with_disabled_value_as_array\n- albums = [ Album.new(1.0, \"first\",\"rap\"), Album.new(2.0, \"second\",\"pop\")] \n+ albums = [ Album.new(1.0, \"first\",\"rap\"), Album.new(2.0, \"second\",\"pop\")]\n \n assert_dom_equal(\n %(<option disabled=\"disabled\" value=\"1.0\">rap</option>\\n<option disabled=\"disabled\" value=\"2.0\">pop</option>),\n@@ -230,7 +237,7 @@ def test_collection_options_with_disabled_value_as_array\n end\n \n def test_collection_options_with_preselected_values_as_string_array_and_option_value_is_float\n- albums = [ Album.new(1.0, \"first\",\"rap\"), Album.new(2.0, \"second\",\"pop\"), Album.new(3.0, \"third\",\"country\") ] \n+ albums = [ Album.new(1.0, \"first\",\"rap\"), Album.new(2.0, \"second\",\"pop\"), Album.new(3.0, \"third\",\"country\") ]\n \n assert_dom_equal(\n %(<option value=\"1.0\" selected=\"selected\">rap</option>\\n<option value=\"2.0\">pop</option>\\n<option value=\"3.0\" selected=\"selected\">country</option>),\n@@ -364,6 +371,15 @@ def test_select\n )\n end\n \n+ def test_select_with_boolean_method\n+ @post = Post.new\n+ @post.allow_comments = false\n+ assert_dom_equal(\n+ \"<select id=\\\"post_allow_comments\\\" name=\\\"post[allow_comments]\\\"><option value=\\\"true\\\">true</option>\\n<option value=\\\"false\\\" selected=\\\"selected\\\">false</option></select>\",\n+ select(\"post\", \"allow_comments\", %w( true false ))\n+ )\n+ end\n+\n def test_select_under_fields_for\n @post = Post.new\n @post.category = \"<mus>\""), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:51 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 18:02:14 GMT",
etag = "\"dddad2f6cabcddcf129d247d9ef0d2f1\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248337:54D9023F",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "065b43cd9674091fec48a221b420fbb3"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "83e6b2509e6868e6d01ef6ffb6ba9a7e68087ea5", filename = "activerecord/lib/active_record/association_preload.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/f367d28948c51bea23938c595f65fc18b582572a/activerecord/lib/active_record/association_preload.rb",
raw_url = "https://github.com/rails/rails/raw/f367d28948c51bea23938c595f65fc18b582572a/activerecord/lib/active_record/association_preload.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/association_preload.rb?ref=f367d28948c51bea23938c595f65fc18b582572a",
patch = "@@ -333,7 +333,7 @@ def preload_belongs_to_association(records, reflection, preload_options={})\n \n table_name = klass.quoted_table_name\n primary_key = reflection.options[:primary_key] || klass.primary_key\n- column_type = klass.columns.detect{|c| c.name == primary_key}.class\n+ column_type = klass.columns.detect{|c| c.name == primary_key.to_s}.class\n ids = id_map.keys.map do |id|\n if column_type == :integer\n id.to_i"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:51 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Sat, 17 Jan 2015 18:52:42 GMT",
etag = "\"a4e45468c4787cf69c6b03e3495813d3\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248359:54D9023F",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "07ff1c8a09e44b62e277fae50a1b1dc4"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "e9a3fea70d2b2af15f45b2af280c388a5254e20a", filename = "actionpack/lib/action_dispatch/routing/mapper.rb",
status = "modified", additions = 3L, deletions = 3L, changes = 6L,
blob_url = "https://github.com/rails/rails/blob/e8dd6c28e20d7dd8d1461b23ed082293f3cc0cc8/actionpack/lib/action_dispatch/routing/mapper.rb",
raw_url = "https://github.com/rails/rails/raw/e8dd6c28e20d7dd8d1461b23ed082293f3cc0cc8/actionpack/lib/action_dispatch/routing/mapper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_dispatch/routing/mapper.rb?ref=e8dd6c28e20d7dd8d1461b23ed082293f3cc0cc8",
patch = "@@ -985,11 +985,11 @@ def resource(*resources, &block)\n #\n # [:path]\n #\n- # Set a path prefix for this resource.\n+ # Set a path for this resource.\n #\n- # resources :posts, :path => \"admin\"\n+ # resources :posts, :path => \"entries\"\n #\n- # All actions for this resource will now be at +/admin/posts+.\n+ # All actions for this resource will now be at +/entries+.\n def resources(*resources, &block)\n options = resources.extract_options!\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:51 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 17:45:09 GMT",
etag = "\"9b59617872f17dbaaf88b20f957cd23d\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248375:54D9023F",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "8dd185e423974a7e13abbbe6e060031e"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "82d33c91bf32321f69994228a26192045c27957c", filename = "activerecord/test/cases/attribute_methods_test.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/7fddd94e027b69dcb2662cc95a61687543304506/activerecord/test/cases/attribute_methods_test.rb",
raw_url = "https://github.com/rails/rails/raw/7fddd94e027b69dcb2662cc95a61687543304506/activerecord/test/cases/attribute_methods_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/attribute_methods_test.rb?ref=7fddd94e027b69dcb2662cc95a61687543304506",
patch = "@@ -131,7 +131,7 @@ def test_read_attributes_before_type_cast_on_datetime\n assert_equal developer.created_at, nil\n \n developer.created_at = \"2010-03-21 21:23:32\"\n- assert_equal developer.created_at_before_type_cast.to_s, \"2010-03-21 21:23:32\"\n+ assert_equal developer.created_at_before_type_cast, \"2010-03-21 21:23:32\"\n assert_equal developer.created_at, Time.parse(\"2010-03-21 21:23:32\")\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:51 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 11:47:47 GMT",
etag = "\"1da9cbe86b84d9640a274ac974b83f91\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248395:54D9023F",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "c6c65e5196703428e7641f7d1e9bc353"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "f07ac44f7ae3dd357086c52d0ef498d14354993b", filename = "actionpack/lib/action_dispatch/http/request.rb",
status = "modified", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/721348e666058b42932e9f9986a2816710d0ba88/actionpack/lib/action_dispatch/http/request.rb",
raw_url = "https://github.com/rails/rails/raw/721348e666058b42932e9f9986a2816710d0ba88/actionpack/lib/action_dispatch/http/request.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_dispatch/http/request.rb?ref=721348e666058b42932e9f9986a2816710d0ba88",
patch = "@@ -2,6 +2,7 @@\n require 'stringio'\n require 'strscan'\n \n+require 'active_support/core_ext/module/deprecation'\n require 'active_support/core_ext/hash/indifferent_access'\n require 'active_support/core_ext/string/access'\n require 'active_support/inflector'"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:51 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 18:02:56 GMT",
etag = "\"cee5fd437908d93d74cfa4fdc16a8e53\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2483BC:54D9023F",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "a241e1a8264a6ace03db946c85b92db3"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "80b549556993a9301b109ba524a13df1658ec071", filename = "activerecord/lib/active_record/relation/predicate_builder.rb",
status = "modified", additions = 4L, deletions = 1L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/08164689eb0825bbc6fb894fba4ab7e08b748577/activerecord/lib/active_record/relation/predicate_builder.rb",
raw_url = "https://github.com/rails/rails/raw/08164689eb0825bbc6fb894fba4ab7e08b748577/activerecord/lib/active_record/relation/predicate_builder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/relation/predicate_builder.rb?ref=08164689eb0825bbc6fb894fba4ab7e08b748577",
patch = "@@ -18,7 +18,10 @@ def self.build_from_hash(engine, attributes, default_table)\n attribute = table[column.to_sym]\n \n case value\n- when Array, ActiveRecord::Associations::AssociationCollection, ActiveRecord::Relation\n+ when ActiveRecord::Relation\n+ value.select_values = Array.wrap(\"#{value.klass.quoted_table_name}.id\") if value.select_values.empty?\n+ attribute.in(value.arel.ast)\n+ when Array, ActiveRecord::Associations::AssociationCollection\n values = value.to_a.map { |x|\n x.is_a?(ActiveRecord::Base) ? x.id : x\n }"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "61eb7e36593c7527930eb68022a8084a550cf259",
filename = "activerecord/test/cases/relations_test.rb", status = "modified",
additions = 28L, deletions = 1L, changes = 29L, blob_url = "https://github.com/rails/rails/blob/08164689eb0825bbc6fb894fba4ab7e08b748577/activerecord/test/cases/relations_test.rb",
raw_url = "https://github.com/rails/rails/raw/08164689eb0825bbc6fb894fba4ab7e08b748577/activerecord/test/cases/relations_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/relations_test.rb?ref=08164689eb0825bbc6fb894fba4ab7e08b748577",
patch = "@@ -467,7 +467,7 @@ def test_find_by_id_with_list_of_ar\n authors = Author.find_by_id([author])\n assert_equal author, authors\n end\n-\n+ \n def test_find_all_using_where_twice_should_or_the_relation\n david = authors(:david)\n relation = Author.unscoped\n@@ -488,6 +488,33 @@ def test_find_all_with_multiple_ors\n end\n assert_equal [david], relation.all\n end\n+ \n+ def test_find_all_using_where_with_relation\n+ david = authors(:david)\n+ # switching the lines below would succeed in current rails\n+ # assert_queries(2) {\n+ assert_queries(1) {\n+ relation = Author.where(:id => Author.where(:id => david.id))\n+ assert_equal [david], relation.all\n+ }\n+ end\n+\n+ def test_find_all_using_where_with_relation_with_joins\n+ david = authors(:david)\n+ assert_queries(1) {\n+ relation = Author.where(:id => Author.joins(:posts).where(:id => david.id))\n+ assert_equal [david], relation.all\n+ }\n+ end\n+\n+ \n+ def test_find_all_using_where_with_relation_with_select_to_build_subquery\n+ david = authors(:david)\n+ assert_queries(1) {\n+ relation = Author.where(:name => Author.where(:id => david.id).select(:name))\n+ assert_equal [david], relation.all\n+ }\n+ end\n \n def test_exists\n davids = Author.where(:name => 'David')"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:51 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Sat, 07 Feb 2015 01:16:29 GMT",
etag = "\"f8cefe78308a08b116ee8563644b26fa\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2483D6:54D9023F",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "b0ef53392caa42315c6206737946d931"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "4f6f606680c2cf11fb8c7582843ea3c6a89102e4", filename = "activesupport/lib/active_support/core_ext/float.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/8d736de8ba64b59aec42afd38292cf358ab019dd/activesupport/lib/active_support/core_ext/float.rb",
raw_url = "https://github.com/rails/rails/raw/8d736de8ba64b59aec42afd38292cf358ab019dd/activesupport/lib/active_support/core_ext/float.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/lib/active_support/core_ext/float.rb?ref=8d736de8ba64b59aec42afd38292cf358ab019dd",
patch = "@@ -1 +1 @@\n-require 'active_support/core_ext/float/rounding'\n+require 'active_support/core_ext/float/rounding' if RUBY_VERSION < '1.9'"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "39a87d9f64a19fc24b1d320b960a06de7c7e54b3",
filename = "railties/guides/source/active_support_core_extensions.textile",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/8d736de8ba64b59aec42afd38292cf358ab019dd/railties/guides/source/active_support_core_extensions.textile",
raw_url = "https://github.com/rails/rails/raw/8d736de8ba64b59aec42afd38292cf358ab019dd/railties/guides/source/active_support_core_extensions.textile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/guides/source/active_support_core_extensions.textile?ref=8d736de8ba64b59aec42afd38292cf358ab019dd",
patch = "@@ -1818,7 +1818,7 @@ h3. Extensions to +Float+\n \n h4. +round+\n \n-The built-in method +Float#round+ rounds a float to the nearest integer. Active Support adds an optional parameter to let you specify a precision:\n+The built-in method +Float#round+ rounds a float to the nearest integer. In Ruby 1.9 this method takes optional parameter to let you specify a precision. Active Support adds that functionality to +round+ in previous versions of Ruby:\n \n <ruby>\n Math::E.round(4) # => 2.7183"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:52 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Wed, 28 Jan 2015 20:22:39 GMT",
etag = "\"adb1773e5f97220ee000cf426b3b2ed1\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2483FA:54D9023F",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "139317cebd6caf9cd03889139437f00b"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "c53f7fe529a1f32d4e7259c0737781f4c6182c64", filename = "activerecord/test/cases/finder_test.rb",
status = "modified", additions = 22L, deletions = 0L, changes = 22L,
blob_url = "https://github.com/rails/rails/blob/d9fefa4c5b56deb7fa35c1859285c6cba6fa3244/activerecord/test/cases/finder_test.rb",
raw_url = "https://github.com/rails/rails/raw/d9fefa4c5b56deb7fa35c1859285c6cba6fa3244/activerecord/test/cases/finder_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/finder_test.rb?ref=d9fefa4c5b56deb7fa35c1859285c6cba6fa3244",
patch = "@@ -997,6 +997,28 @@ def test_find_with_order_on_included_associations_with_construct_finder_sql_for_\n :order => ' author_addresses_authors.id DESC ', :limit => 3).size\n end\n \n+ def test_find_with_nil_inside_set_passed_for_attribute\n+ client_of = Company.find(\n+ :all,\n+ :conditions => {\n+ :client_of => [2, 1, nil],\n+ :name => ['37signals', 'Summit', 'Microsoft'] },\n+ :order => 'client_of DESC'\n+ ).map { |x| x.client_of }\n+\n+ assert_equal [2, 1, nil], client_of\n+ end\n+\n+ def test_find_with_nil_inside_set_passed_for_attribute\n+ client_of = Company.find(\n+ :all,\n+ :conditions => { :client_of => [nil] },\n+ :order => 'client_of DESC'\n+ ).map { |x| x.client_of }\n+\n+ assert_equal [nil], client_of\n+ end\n+\n def test_with_limiting_with_custom_select\n posts = Post.find(:all, :include => :author, :select => ' posts.*, authors.id as \"author_id\"', :limit => 3, :order => 'posts.id')\n assert_equal 3, posts.size"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:52 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 14:17:13 GMT",
etag = "\"97dccdddaad441e1ae4446529a94e78e\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248422:54D90240",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "76d9828c7e4f1d910f7ba069e90ce976"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "3e6f6e62e6e08ff47e2fb7b4fab0a01f2c344232", filename = "activemodel/lib/active_model/validations/length.rb",
status = "modified", additions = 2L, deletions = 1L, changes = 3L,
blob_url = "https://github.com/rails/rails/blob/2dbeede4a772058a6d7a0b0dfd75248b0e788da4/activemodel/lib/active_model/validations/length.rb",
raw_url = "https://github.com/rails/rails/raw/2dbeede4a772058a6d7a0b0dfd75248b0e788da4/activemodel/lib/active_model/validations/length.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/lib/active_model/validations/length.rb?ref=2dbeede4a772058a6d7a0b0dfd75248b0e788da4",
patch = "@@ -42,7 +42,8 @@ def validate_each(record, attribute, value)\n next unless check_value = options[key]\n \n value ||= [] if key == :maximum\n-\n+ \n+ next if value.kind_of?(Fixnum) && value.to_s.size.send(validity_check, check_value)\n next if value && value.size.send(validity_check, check_value)\n \n errors_options = options.except(*RESERVED_OPTIONS)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "5e4f4f5cae5ea84bfd32d2f3b22f2e906c0a1b2d",
filename = "activemodel/test/cases/validations/length_validation_test.rb",
status = "modified", additions = 11L, deletions = 0L, changes = 11L,
blob_url = "https://github.com/rails/rails/blob/2dbeede4a772058a6d7a0b0dfd75248b0e788da4/activemodel/test/cases/validations/length_validation_test.rb",
raw_url = "https://github.com/rails/rails/raw/2dbeede4a772058a6d7a0b0dfd75248b0e788da4/activemodel/test/cases/validations/length_validation_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/test/cases/validations/length_validation_test.rb?ref=2dbeede4a772058a6d7a0b0dfd75248b0e788da4",
patch = "@@ -341,6 +341,17 @@ def test_validates_length_of_with_block\n assert t.errors[:content].any?\n assert_equal [\"Your essay must be at least 5 words.\"], t.errors[:content]\n end\n+ \n+ def test_validates_length_of_for_fixnum\n+ Topic.validates_length_of(:approved, :is => 4)\n+ \n+ t = Topic.new(\"title\" => \"uhohuhoh\", \"content\" => \"whatever\", :approved => 1)\n+ assert t.invalid?\n+ assert t.errors[:approved].any?\n+ \n+ t = Topic.new(\"title\" => \"uhohuhoh\", \"content\" => \"whatever\", :approved => 1234)\n+ assert t.valid?\n+ end\n \n def test_validates_length_of_for_ruby_class\n Person.validates_length_of :karma, :minimum => 5"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:52 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 04:47:35 GMT",
etag = "\"08a697f61eb9762f713af67f8a957256\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248443:54D90240",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "01d096e6cfe28f8aea352e988c332cd3"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "e2a8b4d4e379e0a31e566844fb129c7f32571a81", filename = "activesupport/lib/active_support/descendants_tracker.rb",
status = "modified", additions = 9L, deletions = 7L, changes = 16L,
blob_url = "https://github.com/rails/rails/blob/512057d386075f207d8927a5e0ce3943174d5c78/activesupport/lib/active_support/descendants_tracker.rb",
raw_url = "https://github.com/rails/rails/raw/512057d386075f207d8927a5e0ce3943174d5c78/activesupport/lib/active_support/descendants_tracker.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/lib/active_support/descendants_tracker.rb?ref=512057d386075f207d8927a5e0ce3943174d5c78",
patch = "@@ -1,5 +1,3 @@\n-require 'active_support/dependencies'\n-\n module ActiveSupport\n # This module provides an internal implementation to track descendants\n # which is faster than iterating through ObjectSpace.\n@@ -18,12 +16,16 @@ def self.descendants(klass)\n end\n \n def self.clear\n- @@direct_descendants.each do |klass, descendants|\n- if ActiveSupport::Dependencies.autoloaded?(klass)\n- @@direct_descendants.delete(klass)\n- else\n- descendants.reject! { |v| ActiveSupport::Dependencies.autoloaded?(v) }\n+ if defined? ActiveSupport::Dependencies\n+ @@direct_descendants.each do |klass, descendants|\n+ if ActiveSupport::Dependencies.autoloaded?(klass)\n+ @@direct_descendants.delete(klass)\n+ else\n+ descendants.reject! { |v| ActiveSupport::Dependencies.autoloaded?(v) }\n+ end\n end\n+ else\n+ @@direct_descendants.clear\n end\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c8312aa653c3a1c55659a6c163e7cb9e143e0a4c",
filename = "activesupport/test/core_ext/duration_test.rb",
status = "modified", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/512057d386075f207d8927a5e0ce3943174d5c78/activesupport/test/core_ext/duration_test.rb",
raw_url = "https://github.com/rails/rails/raw/512057d386075f207d8927a5e0ce3943174d5c78/activesupport/test/core_ext/duration_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/test/core_ext/duration_test.rb?ref=512057d386075f207d8927a5e0ce3943174d5c78",
patch = "@@ -1,4 +1,5 @@\n require 'abstract_unit'\n+require 'active_support/inflector'\n require 'active_support/time'\n require 'active_support/json'\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "9371965bbd5a62cbeabcbaab1fe8292c531613a4",
filename = "activesupport/test/core_ext/string_ext_test.rb",
status = "modified", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/512057d386075f207d8927a5e0ce3943174d5c78/activesupport/test/core_ext/string_ext_test.rb",
raw_url = "https://github.com/rails/rails/raw/512057d386075f207d8927a5e0ce3943174d5c78/activesupport/test/core_ext/string_ext_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/test/core_ext/string_ext_test.rb?ref=512057d386075f207d8927a5e0ce3943174d5c78",
patch = "@@ -3,6 +3,7 @@\n require 'abstract_unit'\n require 'inflector_test_cases'\n \n+require 'active_support/inflector'\n require 'active_support/core_ext/string'\n require 'active_support/time'\n require 'active_support/core_ext/kernel/reporting'"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "066ec8549b232188cd741d5ff90803b08ab4000c",
filename = "activesupport/test/descendants_tracker_test_cases.rb",
status = "renamed", additions = 9L, deletions = 27L, changes = 36L,
blob_url = "https://github.com/rails/rails/blob/512057d386075f207d8927a5e0ce3943174d5c78/activesupport/test/descendants_tracker_test_cases.rb",
raw_url = "https://github.com/rails/rails/raw/512057d386075f207d8927a5e0ce3943174d5c78/activesupport/test/descendants_tracker_test_cases.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/test/descendants_tracker_test_cases.rb?ref=512057d386075f207d8927a5e0ce3943174d5c78",
patch = "@@ -1,9 +1,4 @@\n-require 'abstract_unit'\n-require 'test/unit'\n-require 'active_support'\n-require 'active_support/core_ext/hash/slice'\n-\n-class DescendantsTrackerTest < Test::Unit::TestCase\n+module DescendantsTrackerTestCases\n class Parent\n extend ActiveSupport::DescendantsTracker\n end\n@@ -34,7 +29,7 @@ def test_direct_descendants\n assert_equal [], Child2.direct_descendants\n end\n \n- def test_clear_with_autoloaded_parent_children_and_granchildren\n+ def test_clear\n mark_as_autoloaded(*ALL) do\n ActiveSupport::DescendantsTracker.clear\n ALL.each do |k|\n@@ -43,35 +38,22 @@ def test_clear_with_autoloaded_parent_children_and_granchildren\n end\n end\n \n- def test_clear_with_autoloaded_children_and_granchildren\n- mark_as_autoloaded Child1, Grandchild1, Grandchild2 do\n- ActiveSupport::DescendantsTracker.clear\n- assert_equal [Child2], Parent.descendants\n- assert_equal [], Child2.descendants\n- end\n- end\n-\n- def test_clear_with_autoloaded_granchildren\n- mark_as_autoloaded Grandchild1, Grandchild2 do\n- ActiveSupport::DescendantsTracker.clear\n- assert_equal [Child1, Child2], Parent.descendants\n- assert_equal [], Child1.descendants\n- assert_equal [], Child2.descendants\n- end\n- end\n-\n protected\n \n def mark_as_autoloaded(*klasses)\n- old_autoloaded = ActiveSupport::Dependencies.autoloaded_constants.dup\n- ActiveSupport::Dependencies.autoloaded_constants = klasses.map(&:name)\n+ # If ActiveSupport::Dependencies is not loaded, forget about autoloading.\n+ # This allows using AS::DescendantsTracker without AS::Dependencies.\n+ if defined? ActiveSupport::Dependencies\n+ old_autoloaded = ActiveSupport::Dependencies.autoloaded_constants.dup\n+ ActiveSupport::Dependencies.autoloaded_constants = klasses.map(&:name)\n+ end\n \n old_descendants = ActiveSupport::DescendantsTracker.class_eval(\"@@direct_descendants\").dup\n old_descendants.each { |k, v| old_descendants[k] = v.dup }\n \n yield\n ensure\n- ActiveSupport::Dependencies.autoloaded_constants = old_autoloaded\n+ ActiveSupport::Dependencies.autoloaded_constants = old_autoloaded if defined? ActiveSupport::Dependencies\n ActiveSupport::DescendantsTracker.class_eval(\"@@direct_descendants\").replace(old_descendants)\n end\n end\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ae18a56f444ec5415d0f681e3982c00215e620c3",
filename = "activesupport/test/descendants_tracker_with_autoloading_test.rb",
status = "added", additions = 35L, deletions = 0L, changes = 35L,
blob_url = "https://github.com/rails/rails/blob/512057d386075f207d8927a5e0ce3943174d5c78/activesupport/test/descendants_tracker_with_autoloading_test.rb",
raw_url = "https://github.com/rails/rails/raw/512057d386075f207d8927a5e0ce3943174d5c78/activesupport/test/descendants_tracker_with_autoloading_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/test/descendants_tracker_with_autoloading_test.rb?ref=512057d386075f207d8927a5e0ce3943174d5c78",
patch = "@@ -0,0 +1,35 @@\n+require 'abstract_unit'\n+require 'test/unit'\n+require 'active_support/descendants_tracker'\n+require 'active_support/dependencies'\n+require 'descendants_tracker_test_cases'\n+\n+class DescendantsTrackerWithAutoloadingTest < Test::Unit::TestCase\n+ include DescendantsTrackerTestCases\n+\n+ def test_clear_with_autoloaded_parent_children_and_granchildren\n+ mark_as_autoloaded(*ALL) do\n+ ActiveSupport::DescendantsTracker.clear\n+ ALL.each do |k|\n+ assert ActiveSupport::DescendantsTracker.descendants(k).empty?\n+ end\n+ end\n+ end\n+\n+ def test_clear_with_autoloaded_children_and_granchildren\n+ mark_as_autoloaded Child1, Grandchild1, Grandchild2 do\n+ ActiveSupport::DescendantsTracker.clear\n+ assert_equal [Child2], Parent.descendants\n+ assert_equal [], Child2.descendants\n+ end\n+ end\n+\n+ def test_clear_with_autoloaded_granchildren\n+ mark_as_autoloaded Grandchild1, Grandchild2 do\n+ ActiveSupport::DescendantsTracker.clear\n+ assert_equal [Child1, Child2], Parent.descendants\n+ assert_equal [], Child1.descendants\n+ assert_equal [], Child2.descendants\n+ end\n+ end\n+end\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "1f0c32dc3faffb7ccd8d071cf9a40a55a102070e",
filename = "activesupport/test/descendants_tracker_without_autoloading_test.rb",
status = "added", additions = 8L, deletions = 0L, changes = 8L,
blob_url = "https://github.com/rails/rails/blob/512057d386075f207d8927a5e0ce3943174d5c78/activesupport/test/descendants_tracker_without_autoloading_test.rb",
raw_url = "https://github.com/rails/rails/raw/512057d386075f207d8927a5e0ce3943174d5c78/activesupport/test/descendants_tracker_without_autoloading_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/test/descendants_tracker_without_autoloading_test.rb?ref=512057d386075f207d8927a5e0ce3943174d5c78",
patch = "@@ -0,0 +1,8 @@\n+require 'abstract_unit'\n+require 'test/unit'\n+require 'active_support/descendants_tracker'\n+require 'descendants_tracker_test_cases'\n+\n+class DescendantsTrackerWithoutAutoloadingTest < Test::Unit::TestCase\n+ include DescendantsTrackerTestCases\n+end\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "bfff10fff28754d244bac695e589b51f0a8ecd76",
filename = "activesupport/test/multibyte_chars_test.rb",
status = "modified", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/512057d386075f207d8927a5e0ce3943174d5c78/activesupport/test/multibyte_chars_test.rb",
raw_url = "https://github.com/rails/rails/raw/512057d386075f207d8927a5e0ce3943174d5c78/activesupport/test/multibyte_chars_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/test/multibyte_chars_test.rb?ref=512057d386075f207d8927a5e0ce3943174d5c78",
patch = "@@ -1,6 +1,7 @@\n # encoding: utf-8\n require 'abstract_unit'\n require 'multibyte_test_helpers'\n+require 'active_support/core_ext/string/multibyte'\n \n class String\n def __method_for_multibyte_testing_with_integer_result; 1; end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:52 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Sun, 01 Feb 2015 15:05:13 GMT",
etag = "\"b86678d2a180bc41ca321f24551f279e\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248467:54D90240",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "76d9828c7e4f1d910f7ba069e90ce976"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "35e216ac6ba4515354daec75cb6bad5f583d543c", filename = "activemodel/lib/active_model/lint.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/5a32f242d63e7554b591bdcd6bcc942e89038495/activemodel/lib/active_model/lint.rb",
raw_url = "https://github.com/rails/rails/raw/5a32f242d63e7554b591bdcd6bcc942e89038495/activemodel/lib/active_model/lint.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/lib/active_model/lint.rb?ref=5a32f242d63e7554b591bdcd6bcc942e89038495",
patch = "@@ -23,7 +23,7 @@ module Tests\n def test_to_key\n assert model.respond_to?(:to_key), \"The model should respond to to_key\"\n def model.persisted?() false end\n- assert model.to_key.nil?\n+ assert model.to_key.nil?, \"to_key should return nil when `persisted?` returns false\"\n end\n \n # == Responds to <tt>to_param</tt>\n@@ -40,7 +40,7 @@ def test_to_param\n assert model.respond_to?(:to_param), \"The model should respond to to_param\"\n def model.to_key() [1] end\n def model.persisted?() false end\n- assert model.to_param.nil?\n+ assert model.to_param.nil?, \"to_param should return nil when `persited?` returns false\"\n end\n \n # == Responds to <tt>valid?</tt>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:52 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 17:04:09 GMT",
etag = "\"e1ae151ccbc3b381c821949d6992710b\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24848B:54D90240",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "13d09b732ebe76f892093130dc088652"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "37644d6b2e1146204c1787cdb8191827a169b3ad", filename = "activeresource/lib/active_resource/associations.rb",
status = "added", additions = 112L, deletions = 0L, changes = 112L,
blob_url = "https://github.com/rails/rails/blob/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/lib/active_resource/associations.rb",
raw_url = "https://github.com/rails/rails/raw/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/lib/active_resource/associations.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/associations.rb?ref=acde1c927d647cb04925c87aa7491b16e56c374b",
patch = "@@ -0,0 +1,112 @@\n+module ActiveResource::Associations\n+\n+ module Builder\n+ autoload :Association, 'active_resource/associations/builder/association'\n+ autoload :HasMany, 'active_resource/associations/builder/has_many'\n+ autoload :HasOne, 'active_resource/associations/builder/has_one'\n+ autoload :BelongsTo, 'active_resource/associations/builder/belongs_to'\n+ end\n+\n+\n+\n+ # Specifies a one-to-many association.\n+ #\n+ # === Options\n+ # [:class_name]\n+ # Specify the class name of the association. This class name would\n+ # be used for resolving the association class. \n+ #\n+ # ==== Example for [:class_name] - option\n+ # GET /posts/123.xml delivers following response body:\n+ # <post>\n+ # <title>ActiveResource now have associations</title>\n+ # <content> ... </content>\n+ # <comments>\n+ # <comment> ... </comment>\n+ # <comment> ... </comment>\n+ # </comments>\n+ # </post>\n+ # ====\n+ #\n+ # <tt>has_many :comments, :class_name => 'myblog/comment'</tt>\n+ # Would resolve those comments into the <tt>Myblog::Comment</tt> class.\n+ def has_many(name, options = {})\n+ Builder::HasMany.build(self, name, options)\n+ end\n+\n+ # Specifies a one-to-one association.\n+ #\n+ # === Options\n+ # [:class_name]\n+ # Specify the class name of the association. This class name would\n+ # be used for resolving the association class. \n+ #\n+ # ==== Example for [:class_name] - option\n+ # GET /posts/123.xml delivers following response body:\n+ # <post>\n+ # <title>ActiveResource now have associations</title>\n+ # <content> ... </content>\n+ # <author>\n+ # <name>caffeinatedBoys</name>\n+ # </author>\n+ # </post>\n+ # ====\n+ #\n+ # <tt>has_one :author, :class_name => 'myblog/author'</tt>\n+ # Would resolve this author into the <tt>Myblog::Author</tt> class.\n+ def has_one(name, options = {})\n+ Builder::HasOne.build(self, name, options)\n+ end\n+\n+ # Specifies a one-to-one association with another class. This class should only be used\n+ # if this class contains the foreign key. \n+ #\n+ # Methods will be added for retrieval and query for a single associated object, for which\n+ # this object holds an id:\n+ #\n+ # [association(force_reload = false)]\n+ # Returns the associated object. +nil+ is returned if the foreign key is +nil+.\n+ # Throws a ActiveResource::ResourceNotFound exception if the foreign key is not +nil+\n+ # and the resource is not found.\n+ # \n+ # (+association+ is replaced with the symbol passed as the first argument, so\n+ # <tt>belongs_to :post</tt> would add among others <tt>post.nil?</tt>.\n+ #\n+ # === Example\n+ #\n+ # A Comment class declaress <tt>belongs_to :post</tt>, which will add:\n+ # * <tt>Comment#post</tt> (similar to <tt>Post.find(post_id)</tt>)\n+ # The declaration can also include an options hash to specialize the behavior of the association.\n+ #\n+ # === Options\n+ # [:class_name]\n+ # Specify the class name for the association. Use it only if that name canÄt be inferred from association name.\n+ # So <tt>belongs_to :post</tt> will by default be linked to the Post class, but if the real class name is Article,\n+ # you'll have to specify it with whis option.\n+ # [:foreign_key]\n+ # Specify the foreign key used for the association. By default this is guessed to be the name\n+ # of the association with an \"_id\" suffix. So a class that defines a <tt>belongs_to :post</tt>\n+ # association will use \"post_id\" as the default <tt>:foreign_key</tt>. Similarly,\n+ # <tt>belongs_to :article, :class_name => \"Post\"</tt> will use a foreign key\n+ # of \"article_id\".\n+ #\n+ # Option examples:\n+ # <tt>belongs_to :customer, :class_name => 'User'</tt>\n+ # Creates a belongs_to association called customer which is represented through the <tt>User</tt> class.\n+ #\n+ # <tt>belongs_to :customer, :foreign_key => 'user_id'</tt>\n+ # Creates a belongs_to association called customer which would be resolved by the foreign_key <tt>user_id</tt> instead of <tt>customer_id</tt>\n+ #\n+ def belongs_to(name, options={})\n+ Builder::BelongsTo.build(self, name, options)\n+ end\n+\n+ # Defines the belongs_to association finder method\n+ def defines_belongs_to_finder_method(method_name, association_model, finder_key)\n+ define_method(method_name) do\n+ ivar_name = :\"@#{method_name}\"\n+ instance_variable_defined?(ivar_name) ? instance_variable_get(ivar_name) : instance_variable_set(ivar_name, association_model.find(send(finder_key)))\n+ end\n+ end\n+\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "7c5f871ebec9c1acee775e42aadfb0a989702460",
filename = "activeresource/lib/active_resource/associations/builder/association.rb",
status = "added", additions = 32L, deletions = 0L, changes = 32L,
blob_url = "https://github.com/rails/rails/blob/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/lib/active_resource/associations/builder/association.rb",
raw_url = "https://github.com/rails/rails/raw/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/lib/active_resource/associations/builder/association.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/associations/builder/association.rb?ref=acde1c927d647cb04925c87aa7491b16e56c374b",
patch = "@@ -0,0 +1,32 @@\n+module ActiveResource::Associations::Builder\n+ class Association #:nodoc:\n+\n+ # providing a Class-Variable, which will have a different store of subclasses\n+ class_attribute :valid_options\n+ self.valid_options = [:class_name]\n+\n+ # would identify subclasses of association\n+ class_attribute :macro\n+\n+ attr_reader :model, :name, :options, :klass\n+\n+ def self.build(model, name, options)\n+ new(model, name, options).build\n+ end\n+\n+ def initialize(model, name, options)\n+ @model, @name, @options = model, name, options\n+ end\n+\n+ def build\n+ validate_options\n+ reflection = model.create_reflection(self.class.macro, name, options)\n+ end\n+\n+ private\n+\n+ def validate_options\n+ options.assert_valid_keys(self.class.valid_options)\n+ end\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "b77718d8c830fd140a0c312890f74cc5f0df5c91",
filename = "activeresource/lib/active_resource/associations/builder/belongs_to.rb",
status = "added", additions = 14L, deletions = 0L, changes = 14L,
blob_url = "https://github.com/rails/rails/blob/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/lib/active_resource/associations/builder/belongs_to.rb",
raw_url = "https://github.com/rails/rails/raw/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/lib/active_resource/associations/builder/belongs_to.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/associations/builder/belongs_to.rb?ref=acde1c927d647cb04925c87aa7491b16e56c374b",
patch = "@@ -0,0 +1,14 @@\n+module ActiveResource::Associations::Builder \n+ class BelongsTo < Association\n+ self.valid_options += [:foreign_key]\n+\n+ self.macro = :belongs_to\n+\n+ def build\n+ validate_options\n+ reflection = model.create_reflection(self.class.macro, name, options)\n+ model.defines_belongs_to_finder_method(reflection.name, reflection.klass, reflection.foreign_key)\n+ return reflection\n+ end\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "074bae1d494880f41163a402bd28e47f8bf95439",
filename = "activeresource/lib/active_resource/associations/builder/has_many.rb",
status = "added", additions = 5L, deletions = 0L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/lib/active_resource/associations/builder/has_many.rb",
raw_url = "https://github.com/rails/rails/raw/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/lib/active_resource/associations/builder/has_many.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/associations/builder/has_many.rb?ref=acde1c927d647cb04925c87aa7491b16e56c374b",
patch = "@@ -0,0 +1,5 @@\n+module ActiveResource::Associations::Builder \n+ class HasMany < Association\n+ self.macro = :has_many \n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "897e0708948dfdcd00e6dfe65f94084c450996bb",
filename = "activeresource/lib/active_resource/associations/builder/has_one.rb",
status = "added", additions = 5L, deletions = 0L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/lib/active_resource/associations/builder/has_one.rb",
raw_url = "https://github.com/rails/rails/raw/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/lib/active_resource/associations/builder/has_one.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/associations/builder/has_one.rb?ref=acde1c927d647cb04925c87aa7491b16e56c374b",
patch = "@@ -0,0 +1,5 @@\n+module ActiveResource::Associations::Builder \n+ class HasOne < Association\n+ self.macro = :has_one\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "8f121542ff30e84dce4ba5243c7a2acb197830d5",
filename = "activeresource/lib/active_resource/base.rb",
status = "modified", additions = 8L, deletions = 0L, changes = 8L,
blob_url = "https://github.com/rails/rails/blob/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/lib/active_resource/base.rb",
raw_url = "https://github.com/rails/rails/raw/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/lib/active_resource/base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/base.rb?ref=acde1c927d647cb04925c87aa7491b16e56c374b",
patch = "@@ -17,6 +17,8 @@\n require 'active_resource/formats'\n require 'active_resource/schema'\n require 'active_resource/log_subscriber'\n+require 'active_resource/associations'\n+require 'active_resource/reflection'\n \n module ActiveResource\n # ActiveResource::Base is the main class for mapping RESTful resources as models in a Rails application.\n@@ -1403,6 +1405,7 @@ def response_code_allows_body?(c)\n \n # Tries to find a resource for a given collection name; if it fails, then the resource is created\n def find_or_create_resource_for_collection(name)\n+ return reflections[name.to_sym].klass if reflections.key?(name.to_sym)\n find_or_create_resource_for(ActiveSupport::Inflector.singularize(name.to_s))\n end\n \n@@ -1423,6 +1426,8 @@ def find_or_create_resource_in_modules(resource_name, module_names)\n \n # Tries to find a resource for a given name; if it fails, then the resource is created\n def find_or_create_resource_for(name)\n+ return reflections[name.to_sym].klass if reflections.key?(name.to_sym)\n+\n resource_name = name.to_s.camelize\n \n const_args = RUBY_VERSION < \"1.9\" ? [resource_name] : [resource_name, false]\n@@ -1475,9 +1480,12 @@ def method_missing(method_symbol, *arguments) #:nodoc:\n \n class Base\n extend ActiveModel::Naming\n+ extend ActiveResource::Associations\n+\n include CustomMethods, Observing, Validations\n include ActiveModel::Conversion\n include ActiveModel::Serializers::JSON\n include ActiveModel::Serializers::Xml\n+ include ActiveResource::Reflection\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "e9f5a9ba164750ddfbb5be7bcadf0d2616601dec",
filename = "activeresource/lib/active_resource/reflection.rb",
status = "added", additions = 77L, deletions = 0L, changes = 77L,
blob_url = "https://github.com/rails/rails/blob/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/lib/active_resource/reflection.rb",
raw_url = "https://github.com/rails/rails/raw/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/lib/active_resource/reflection.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/reflection.rb?ref=acde1c927d647cb04925c87aa7491b16e56c374b",
patch = "@@ -0,0 +1,77 @@\n+require 'active_support/core_ext/class/attribute'\n+require 'active_support/core_ext/module/deprecation'\n+\n+module ActiveResource\n+ # = Active Resource reflection\n+ #\n+ # Associations in ActiveResource would be used to resolve nested attributes\n+ # in a response with correct classes.\n+ # Now they could be specified over Associations with the options :class_name\n+ module Reflection # :nodoc:\n+ extend ActiveSupport::Concern\n+\n+ included do\n+ class_attribute :reflections\n+ self.reflections = {}\n+ end\n+\n+ module ClassMethods\n+ def create_reflection(macro, name, options)\n+ reflection = AssociationReflection.new(macro, name, options)\n+ self.reflections = self.reflections.merge(name => reflection)\n+ reflection\n+ end\n+ end\n+\n+\n+ class AssociationReflection\n+\n+ def initialize(macro, name, options)\n+ @macro, @name, @options = macro, name, options\n+ end\n+\n+ # Returns the name of the macro.\n+ #\n+ # <tt>has_many :clients</tt> returns <tt>:clients</tt>\n+ attr_reader :name\n+\n+ # Returns the macro type.\n+ #\n+ # <tt>has_many :clients</tt> returns <tt>:has_many</tt>\n+ attr_reader :macro\n+\n+ # Returns the hash of options used for the macro.\n+ #\n+ # <tt>has_many :clients</tt> returns +{}+\n+ attr_reader :options\n+\n+ # Returns the class for the macro.\n+ #\n+ # <tt>has_many :clients</tt> returns the Client class\n+ def klass\n+ @klass ||= class_name.constantize\n+ end\n+\n+ # Returns the class name for the macro.\n+ #\n+ # <tt>has_many :clients</tt> returns <tt>'Client'</tt>\n+ def class_name\n+ @class_name ||= derive_class_name\n+ end\n+\n+ # Returns the foreign_key for the macro.\n+ def foreign_key\n+ @foreign_key ||= self.options[:foreign_key] || \"#{self.name.to_s.downcase}_id\"\n+ end\n+\n+ private\n+ def derive_class_name\n+ return (options[:class_name] ? options[:class_name].to_s : name.to_s).classify\n+ end\n+\n+ def derive_foreign_key\n+ return options[:foreign_key] ? options[:foreign_key].to_s : \"#{name.to_s.downcase}_id\"\n+ end\n+ end\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "5cfa22a82b7352fd0333bd71fe967ebf8a68f4b0",
filename = "activeresource/test/abstract_unit.rb", status = "modified",
additions = 3L, deletions = 1L, changes = 4L, blob_url = "https://github.com/rails/rails/blob/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/test/abstract_unit.rb",
raw_url = "https://github.com/rails/rails/raw/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/test/abstract_unit.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/test/abstract_unit.rb?ref=acde1c927d647cb04925c87aa7491b16e56c374b",
patch = "@@ -74,7 +74,9 @@ def setup_response\n :children => []\n }\n ]\n- }]\n+ }],\n+ :enemies => [{:name => 'Joker'}],\n+ :mother => {:name => 'Ingeborg'}\n }\n }.to_json\n # - resource with yaml array of strings; for ARs using serialize :bar, Array"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "0a6c4e61a62f88d7634252964ab9f648b39de799",
filename = "activeresource/test/cases/association_test.rb",
status = "added", additions = 71L, deletions = 0L, changes = 71L,
blob_url = "https://github.com/rails/rails/blob/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/test/cases/association_test.rb",
raw_url = "https://github.com/rails/rails/raw/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/test/cases/association_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/test/cases/association_test.rb?ref=acde1c927d647cb04925c87aa7491b16e56c374b",
patch = "@@ -0,0 +1,71 @@\n+require 'abstract_unit'\n+\n+require 'fixtures/person'\n+require 'fixtures/beast'\n+require 'fixtures/customer'\n+\n+\n+class AssociationTest < Test::Unit::TestCase\n+ def setup\n+ @klass = ActiveResource::Associations::Builder::Association\n+ end\n+\n+\n+ def test_validations_for_instance\n+ object = @klass.new(Person, :customers, {})\n+ assert_equal({}, object.send(:validate_options))\n+ end\n+\n+ def test_instance_build\n+ object = @klass.new(Person, :customers, {})\n+ assert_kind_of ActiveResource::Reflection::AssociationReflection, object.build\n+ end\n+\n+ def test_valid_options\n+ assert @klass.build(Person, :customers, {:class_name => 'Client'})\n+\n+ assert_raise ArgumentError do\n+ @klass.build(Person, :customers, {:soo_invalid => true})\n+ end\n+ end\n+\n+ def test_association_class_build\n+ assert_kind_of ActiveResource::Reflection::AssociationReflection, @klass.build(Person, :customers, {})\n+ end\n+\n+ def test_has_many\n+ External::Person.has_many(:people)\n+ assert_equal 1, External::Person.reflections.select{|name, reflection| reflection.macro.eql?(:has_many)}.count\n+ end\n+\n+ def test_has_one\n+ External::Person.has_one(:customer)\n+ assert_equal 1, External::Person.reflections.select{|name, reflection| reflection.macro.eql?(:has_one)}.count\n+ end\n+\n+ def test_has_many\n+ External::Person.send(:has_many, :people)\n+ assert_equal 1, External::Person.reflections.select{|name, reflection| reflection.macro.eql?(:has_many)}.count\n+ end\n+\n+ def test_has_one\n+ External::Person.send(:has_one, :customer)\n+ assert_equal 1, External::Person.reflections.select{|name, reflection| reflection.macro.eql?(:has_one)}.count\n+ end\n+\n+ def test_belongs_to\n+ External::Person.belongs_to(:Customer)\n+ assert_equal 1, External::Person.reflections.select{|name, reflection| reflection.macro.eql?(:belongs_to)}.count\n+ end\n+\n+ def test_defines_belongs_to_finder_method_with_instance_variable_cache\n+ Person.defines_belongs_to_finder_method(:customer, Customer, 'customer_id')\n+\n+ person = Person.new\n+ assert !person.instance_variable_defined?(:@customer)\n+ person.stubs(:customer_id).returns(2)\n+ Customer.expects(:find).with(2).once()\n+ 2.times{person.customer}\n+ assert person.instance_variable_defined?(:@customer)\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "a41168bf2bea9a59a56d1db1ebce4791579cc698",
filename = "activeresource/test/cases/associations/builder/belongs_to_test.rb",
status = "added", additions = 35L, deletions = 0L, changes = 35L,
blob_url = "https://github.com/rails/rails/blob/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/test/cases/associations/builder/belongs_to_test.rb",
raw_url = "https://github.com/rails/rails/raw/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/test/cases/associations/builder/belongs_to_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/test/cases/associations/builder/belongs_to_test.rb?ref=acde1c927d647cb04925c87aa7491b16e56c374b",
patch = "@@ -0,0 +1,35 @@\n+\n+require 'abstract_unit'\n+\n+require 'fixtures/person'\n+require 'fixtures/beast'\n+require 'fixtures/customer'\n+\n+\n+class ActiveResource::Associations::Builder::BelongsToTest < Test::Unit::TestCase\n+ def setup\n+ @klass = ActiveResource::Associations::Builder::BelongsTo\n+ end\n+\n+\n+ def test_validations_for_instance\n+ object = @klass.new(Person, :customer, {})\n+ assert_equal({}, object.send(:validate_options))\n+ end\n+\n+ def test_instance_build\n+ object = @klass.new(Person, :customer, {})\n+ Person.expects(:defines_belongs_to_finder_method).with(:customer, Customer, 'customer_id')\n+ assert_kind_of ActiveResource::Reflection::AssociationReflection, object.build\n+ end\n+\n+\n+ def test_valid_options\n+ assert @klass.build(Person, :customer, {:class_name => 'Person'})\n+ assert @klass.build(Person, :customer, {:foreign_key => 'person_id'})\n+\n+ assert_raise ArgumentError do\n+ @klass.build(Person, :customer, {:soo_invalid => true})\n+ end\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "e9342ce20162be7ba10f33c137c53c9b7d8f9fad",
filename = "activeresource/test/cases/base_test.rb", status = "modified",
additions = 14L, deletions = 0L, changes = 14L, blob_url = "https://github.com/rails/rails/blob/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/test/cases/base_test.rb",
raw_url = "https://github.com/rails/rails/raw/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/test/cases/base_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/test/cases/base_test.rb?ref=acde1c927d647cb04925c87aa7491b16e56c374b",
patch = "@@ -1077,6 +1077,20 @@ def test_parse_deep_nested_resources\n end\n end\n \n+ def test_parse_resource_with_given_has_one_resources\n+ Customer.send(:has_one, :mother, :class_name => \"external/person\")\n+ luis = Customer.find(1)\n+ assert_kind_of External::Person, luis.mother\n+ end\n+\n+ def test_parse_resources_with_given_has_many_resources\n+ Customer.send(:has_many, :enemies, :class_name => \"external/person\")\n+ luis = Customer.find(1)\n+ luis.enemies.each do |enemy|\n+ assert_kind_of External::Person, enemy\n+ end\n+ end\n+\n def test_load_yaml_array\n assert_nothing_raised do\n Person.format = :xml"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "4876d4622558a8d88b047bb143fcd21882daed72",
filename = "activeresource/test/cases/reflection_test.rb",
status = "added", additions = 59L, deletions = 0L, changes = 59L,
blob_url = "https://github.com/rails/rails/blob/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/test/cases/reflection_test.rb",
raw_url = "https://github.com/rails/rails/raw/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/test/cases/reflection_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/test/cases/reflection_test.rb?ref=acde1c927d647cb04925c87aa7491b16e56c374b",
patch = "@@ -0,0 +1,59 @@\n+require 'abstract_unit'\n+\n+require 'fixtures/person'\n+require 'fixtures/customer'\n+\n+\n+\n+class ReflectionTest < Test::Unit::TestCase\n+\n+ def test_correct_class_attributes\n+ object = ActiveResource::Reflection::AssociationReflection.new(:test, :people, {})\n+ assert_equal :people, object.name\n+ assert_equal :test, object.macro\n+ assert_equal({}, object.options)\n+ end\n+\n+ def test_correct_class_name_matching_without_class_name\n+ object = ActiveResource::Reflection::AssociationReflection.new(:test, :people, {})\n+ assert_equal Person, object.klass\n+ end\n+\n+ def test_correct_class_name_matching_as_string\n+ object = ActiveResource::Reflection::AssociationReflection.new(:test, :people, {:class_name => 'Person'})\n+ assert_equal Person, object.klass\n+ end\n+\n+ def test_correct_class_name_matching_as_symbol\n+ object = ActiveResource::Reflection::AssociationReflection.new(:test, :people, {:class_name => :person})\n+ assert_equal Person, object.klass\n+ end\n+\n+ def test_correct_class_name_matching_as_class\n+ object = ActiveResource::Reflection::AssociationReflection.new(:test, :people, {:class_name => Person})\n+ assert_equal Person, object.klass\n+ end\n+\n+ def test_correct_class_name_matching_as_string_with_namespace\n+ object = ActiveResource::Reflection::AssociationReflection.new(:test, :people, {:class_name => 'external/person'})\n+ assert_equal External::Person, object.klass\n+ end\n+\n+ def test_foreign_key_method_with_no_foreign_key_option\n+ object = ActiveResource::Reflection::AssociationReflection.new(:test, :person, {})\n+ assert_equal 'person_id', object.foreign_key\n+ end\n+\n+ def test_foreign_key_method_with_with_foreign_key_option\n+ object = ActiveResource::Reflection::AssociationReflection.new(:test, :people, {:foreign_key => 'client_id'})\n+ assert_equal 'client_id', object.foreign_key\n+ end\n+\n+ def test_creation_of_reflection\n+ object = Person.create_reflection(:test, :people, {})\n+ assert_equal ActiveResource::Reflection::AssociationReflection, object.class\n+ assert Person.reflections[:people].present?\n+ assert_equal Person, Person.reflections[:people].klass\n+ end\n+\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "948965b485fa28a865234e54ab38c419bcae78d1",
filename = "activeresource/test/fixtures/person.rb", status = "modified",
additions = 7L, deletions = 0L, changes = 7L, blob_url = "https://github.com/rails/rails/blob/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/test/fixtures/person.rb",
raw_url = "https://github.com/rails/rails/raw/acde1c927d647cb04925c87aa7491b16e56c374b/activeresource/test/fixtures/person.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/test/fixtures/person.rb?ref=acde1c927d647cb04925c87aa7491b16e56c374b",
patch = "@@ -1,3 +1,10 @@\n class Person < ActiveResource::Base\n self.site = \"http://37s.sunrise.i:3000\"\n end\n+\n+module External\n+ class Person < ActiveResource::Base\n+ self.site = \"http://atq.caffeine.intoxication.it\"\n+ end\n+end\n+"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:52 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 16:50:24 GMT",
etag = "\"d27964c4e94a4ee9de0ebc9c3b7d135d\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2484AF:54D90240",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "76d9828c7e4f1d910f7ba069e90ce976"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "128e0fbd86743345ab24141458af63271a48f277", filename = "activerecord/lib/active_record/relation/spawn_methods.rb",
status = "modified", additions = 6L, deletions = 0L, changes = 6L,
blob_url = "https://github.com/rails/rails/blob/a0bd5ba2fa38155ef6c036b256b08414eb9a2af1/activerecord/lib/active_record/relation/spawn_methods.rb",
raw_url = "https://github.com/rails/rails/raw/a0bd5ba2fa38155ef6c036b256b08414eb9a2af1/activerecord/lib/active_record/relation/spawn_methods.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/relation/spawn_methods.rb?ref=a0bd5ba2fa38155ef6c036b256b08414eb9a2af1",
patch = "@@ -79,6 +79,9 @@ def except(*skips)\n result.send(:\"#{method}_value=\", send(:\"#{method}_value\"))\n end\n \n+ # Apply scope extension modules\n+ result.send(:apply_modules, extensions)\n+\n result\n end\n \n@@ -100,6 +103,9 @@ def only(*onlies)\n result.send(:\"#{method}_value=\", send(:\"#{method}_value\"))\n end\n \n+ # Apply scope extension modules\n+ result.send(:apply_modules, extensions)\n+\n result\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "f0e483b6bc8a73841fb32287022e27e1c678d090",
filename = "activerecord/test/cases/relations_test.rb", status = "modified",
additions = 8L, deletions = 0L, changes = 8L, blob_url = "https://github.com/rails/rails/blob/a0bd5ba2fa38155ef6c036b256b08414eb9a2af1/activerecord/test/cases/relations_test.rb",
raw_url = "https://github.com/rails/rails/raw/a0bd5ba2fa38155ef6c036b256b08414eb9a2af1/activerecord/test/cases/relations_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/relations_test.rb?ref=a0bd5ba2fa38155ef6c036b256b08414eb9a2af1",
patch = "@@ -797,6 +797,10 @@ def test_except\n assert_equal Post.all, all_posts.all\n end\n \n+ def test_extensions_with_except\n+ assert_equal 2, Topic.named_extension.order(:author_name).except(:order).two\n+ end\n+\n def test_only\n relation = Post.where(:author_id => 1).order('id ASC').limit(1)\n assert_equal [posts(:welcome)], relation.all\n@@ -808,6 +812,10 @@ def test_only\n assert_equal Post.limit(1).all.first, all_posts.first\n end\n \n+ def test_extensions_with_only\n+ assert_equal 2, Topic.named_extension.order(:author_name).only(:order).two\n+ end\n+\n def test_anonymous_extension\n relation = Post.where(:author_id => 1).order('id ASC').extending do\n def author"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:52 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 18:24:31 GMT",
etag = "\"a3db503b4c9d60fe6473ef66494d609d\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2484DB:54D90240",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "173530fed4bbeb1e264b2ed22e8b5c20"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "f9c52e322851c9588a8716d8158466673f79f55b", filename = "actionpack/lib/action_view/template/resolver.rb",
status = "modified", additions = 78L, deletions = 19L, changes = 97L,
blob_url = "https://github.com/rails/rails/blob/190b32585efd4dcb1218e202af716e1ec7040290/actionpack/lib/action_view/template/resolver.rb",
raw_url = "https://github.com/rails/rails/raw/190b32585efd4dcb1218e202af716e1ec7040290/actionpack/lib/action_view/template/resolver.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_view/template/resolver.rb?ref=190b32585efd4dcb1218e202af716e1ec7040290",
patch = "@@ -5,6 +5,25 @@\n module ActionView\n # = Action View Resolver\n class Resolver\n+ # Keeps all information about view path and builds virtual path.\n+ class Path < String\n+ attr_reader :name, :prefix, :partial, :virtual\n+ alias_method :partial?, :partial\n+\n+ def initialize(name, prefix, partial)\n+ @name, @prefix, @partial = name, prefix, partial\n+ rebuild(@name, @prefix, @partial)\n+ end\n+\n+ def rebuild(name, prefix, partial)\n+ @virtual = \"\"\n+ @virtual << \"#{prefix}/\" unless prefix.empty?\n+ @virtual << (partial ? \"_#{name}\" : name)\n+\n+ self.replace(@virtual)\n+ end\n+ end\n+\n cattr_accessor :caching\n self.caching = true\n \n@@ -41,10 +60,7 @@ def find_templates(name, prefix, partial, details)\n \n # Helpers that builds a path. Useful for building virtual paths.\n def build_path(name, prefix, partial)\n- path = \"\"\n- path << \"#{prefix}/\" unless prefix.empty?\n- path << (partial ? \"_#{name}\" : name)\n- path\n+ Path.new(name, prefix, partial)\n end\n \n # Handles templates caching. If a key is given and caching is on\n@@ -97,25 +113,24 @@ def sort_locals(locals) #:nodoc:\n end\n \n class PathResolver < Resolver\n- EXTENSION_ORDER = [:locale, :formats, :handlers]\n+ EXTENSIONS = [:locale, :formats, :handlers]\n+ DEFAULT_PATTERN = \":prefix/:action{.:locale,}{.:formats,}{.:handlers,}\"\n+\n+ def initialize(pattern=nil)\n+ @pattern = pattern || DEFAULT_PATTERN\n+ super()\n+ end\n \n private\n \n def find_templates(name, prefix, partial, details)\n path = build_path(name, prefix, partial)\n- query(path, EXTENSION_ORDER.map { |ext| details[ext] }, details[:formats])\n+ extensions = Hash[EXTENSIONS.map { |ext| [ext, details[ext]] }.flatten(0)]\n+ query(path, extensions, details[:formats])\n end\n \n def query(path, exts, formats)\n- query = File.join(@path, path)\n-\n- query << exts.map { |ext|\n- \"{#{ext.compact.map { |e| \".#{e}\" }.join(',')},}\"\n- }.join\n-\n- query.gsub!(/\\{\\.html,/, \"{.html,.text.html,\")\n- query.gsub!(/\\{\\.text,/, \"{.text,.text.plain,\")\n-\n+ query = build_query(path, exts)\n templates = []\n sanitizer = Hash.new { |h,k| h[k] = Dir[\"#{File.dirname(k)}/*\"] }\n \n@@ -126,12 +141,28 @@ def query(path, exts, formats)\n contents = File.open(p, \"rb\") {|io| io.read }\n \n templates << Template.new(contents, File.expand_path(p), handler,\n- :virtual_path => path, :format => format, :updated_at => mtime(p))\n+ :virtual_path => path.virtual, :format => format, :updated_at => mtime(p))\n end\n \n templates\n end\n \n+ # Helper for building query glob string based on resolver's pattern. \n+ def build_query(path, exts)\n+ query = @pattern.dup\n+ query.gsub!(/\\:prefix(\\/)?/, path.prefix.empty? ? \"\" : \"#{path.prefix}\\\\1\") # prefix can be empty...\n+ query.gsub!(/\\:action/, path.partial? ? \"_#{path.name}\" : path.name)\n+\n+ exts.each { |ext, variants|\n+ query.gsub!(/\\:#{ext}/, \"{#{variants.compact.uniq.join(',')}}\")\n+ }\n+\n+ query.gsub!(/\\.{html,/, \".{html,text.html,\")\n+ query.gsub!(/\\.{text,/, \".{text,text.plain,\")\n+\n+ File.expand_path(query, @path)\n+ end\n+\n # Returns the file mtime from the filesystem.\n def mtime(p)\n File.stat(p).mtime\n@@ -149,11 +180,39 @@ def extract_handler_and_format(path, default_formats)\n end\n end\n \n- # A resolver that loads files from the filesystem.\n+ # A resolver that loads files from the filesystem. It allows to set your own\n+ # resolving pattern. Such pattern can be a glob string supported by some variables.\n+ #\n+ # ==== Examples\n+ #\n+ # Default pattern, loads views the same way as previous versions of rails, eg. when you're\n+ # looking for `users/new` it will produce query glob: `users/new{.{en},}{.{html,js},}{.{erb,haml,rjs},}`\n+ #\n+ # FileSystemResolver.new(\"/path/to/views\", \":prefix/:action{.:locale,}{.:formats,}{.:handlers,}\")\n+ #\n+ # This one allows you to keep files with different formats in seperated subdirectories,\n+ # eg. `users/new.html` will be loaded from `users/html/new.erb` or `users/new.html.erb`,\n+ # `users/new.js` from `users/js/new.erb` or `users/new.js.erb`, etc.\n+ #\n+ # FileSystemResolver.new(\"/path/to/views\", \":prefix/{:formats/,}:action{.:locale,}{.:formats,}{.:handlers,}\")\n+ #\n+ # If you don't specify pattern then the default will be used.\n+ #\n+ # ==== Pattern format and variables\n+ #\n+ # Pattern have to be a valid glob string, and it allows you to use the\n+ # following variables:\n+ #\n+ # * <tt>:prefix</tt> - usualy the controller path\n+ # * <tt>:action</tt> - name of the action\n+ # * <tt>:locale</tt> - possible locale versions\n+ # * <tt>:formats</tt> - possible file formats\n+ # * <tt>:handlers</tt> - possible handlers\n+ #\n class FileSystemResolver < PathResolver\n- def initialize(path)\n+ def initialize(path, pattern=nil)\n raise ArgumentError, \"path already is a Resolver class\" if path.is_a?(Resolver)\n- super()\n+ super(pattern)\n @path = File.expand_path(path)\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "773dfcbb1dc2277c7f4fe8d78deb59f3709e3a56",
filename = "actionpack/lib/action_view/testing/resolvers.rb",
status = "modified", additions = 6L, deletions = 6L, changes = 12L,
blob_url = "https://github.com/rails/rails/blob/190b32585efd4dcb1218e202af716e1ec7040290/actionpack/lib/action_view/testing/resolvers.rb",
raw_url = "https://github.com/rails/rails/raw/190b32585efd4dcb1218e202af716e1ec7040290/actionpack/lib/action_view/testing/resolvers.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_view/testing/resolvers.rb?ref=190b32585efd4dcb1218e202af716e1ec7040290",
patch = "@@ -8,8 +8,8 @@ module ActionView #:nodoc:\n class FixtureResolver < PathResolver\n attr_reader :hash\n \n- def initialize(hash = {})\n- super()\n+ def initialize(hash = {}, pattern=nil)\n+ super(pattern)\n @hash = hash\n end\n \n@@ -21,8 +21,8 @@ def to_s\n \n def query(path, exts, formats)\n query = \"\"\n- exts.each do |ext|\n- query << '(' << ext.map {|e| e && Regexp.escape(\".#{e}\") }.join('|') << '|)'\n+ EXTENSIONS.each do |ext|\n+ query << '(' << exts[ext].map {|e| e && Regexp.escape(\".#{e}\") }.join('|') << '|)'\n end\n query = /^(#{Regexp.escape(path)})#{query}$/\n \n@@ -32,9 +32,9 @@ def query(path, exts, formats)\n next unless _path =~ query\n handler, format = extract_handler_and_format(_path, formats)\n templates << Template.new(source, _path, handler,\n- :virtual_path => $1, :format => format, :updated_at => updated_at)\n+ :virtual_path => path.virtual, :format => format, :updated_at => updated_at)\n end\n-\n+ \n templates.sort_by {|t| -t.identifier.match(/^#{query}$/).captures.reject(&:blank?).size }\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "6d7f3bafbba9fb585874f3a52ffb110771314eda",
filename = "actionpack/test/fixtures/custom_pattern/another.html.erb",
status = "added", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/190b32585efd4dcb1218e202af716e1ec7040290/actionpack/test/fixtures/custom_pattern/another.html.erb",
raw_url = "https://github.com/rails/rails/raw/190b32585efd4dcb1218e202af716e1ec7040290/actionpack/test/fixtures/custom_pattern/another.html.erb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/fixtures/custom_pattern/another.html.erb?ref=190b32585efd4dcb1218e202af716e1ec7040290",
patch = "@@ -0,0 +1 @@\n+Hello custom patterns!\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "dbd7e96ab682f810b5569d66ae85df60a8ca0199",
filename = "actionpack/test/fixtures/custom_pattern/html/another.erb",
status = "added", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/190b32585efd4dcb1218e202af716e1ec7040290/actionpack/test/fixtures/custom_pattern/html/another.erb",
raw_url = "https://github.com/rails/rails/raw/190b32585efd4dcb1218e202af716e1ec7040290/actionpack/test/fixtures/custom_pattern/html/another.erb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/fixtures/custom_pattern/html/another.erb?ref=190b32585efd4dcb1218e202af716e1ec7040290",
patch = "@@ -0,0 +1 @@\n+Another template!\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "6d7f3bafbba9fb585874f3a52ffb110771314eda",
filename = "actionpack/test/fixtures/custom_pattern/html/path.erb",
status = "added", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/190b32585efd4dcb1218e202af716e1ec7040290/actionpack/test/fixtures/custom_pattern/html/path.erb",
raw_url = "https://github.com/rails/rails/raw/190b32585efd4dcb1218e202af716e1ec7040290/actionpack/test/fixtures/custom_pattern/html/path.erb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/fixtures/custom_pattern/html/path.erb?ref=190b32585efd4dcb1218e202af716e1ec7040290",
patch = "@@ -0,0 +1 @@\n+Hello custom patterns!\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "97b1bad055900fdafa937d78c632b36b97c5623c",
filename = "actionpack/test/template/resolver_patterns_test.rb",
status = "added", additions = 31L, deletions = 0L, changes = 31L,
blob_url = "https://github.com/rails/rails/blob/190b32585efd4dcb1218e202af716e1ec7040290/actionpack/test/template/resolver_patterns_test.rb",
raw_url = "https://github.com/rails/rails/raw/190b32585efd4dcb1218e202af716e1ec7040290/actionpack/test/template/resolver_patterns_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/template/resolver_patterns_test.rb?ref=190b32585efd4dcb1218e202af716e1ec7040290",
patch = "@@ -0,0 +1,31 @@\n+require 'abstract_unit'\n+\n+class ResolverPatternsTest < ActiveSupport::TestCase\n+ def setup\n+ path = File.expand_path(\"../../fixtures/\", __FILE__)\n+ pattern = \":prefix/{:formats/,}:action{.:formats,}{.:handlers,}\"\n+ @resolver = ActionView::FileSystemResolver.new(path, pattern)\n+ end\n+\n+ def test_should_return_empty_list_for_unknown_path\n+ templates = @resolver.find_all(\"unknown\", \"custom_pattern\", false, {:locale => [], :formats => [:html], :handlers => [:erb]})\n+ assert_equal [], templates, \"expected an empty list of templates\"\n+ end\n+\n+ def test_should_return_template_for_declared_path\n+ templates = @resolver.find_all(\"path\", \"custom_pattern\", false, {:locale => [], :formats => [:html], :handlers => [:erb]})\n+ assert_equal 1, templates.size, \"expected one template\"\n+ assert_equal \"Hello custom patterns!\", templates.first.source\n+ assert_equal \"custom_pattern/path\", templates.first.virtual_path\n+ assert_equal [:html], templates.first.formats\n+ end\n+\n+ def test_should_return_all_templates_when_ambigous_pattern\n+ templates = @resolver.find_all(\"another\", \"custom_pattern\", false, {:locale => [], :formats => [:html], :handlers => [:erb]})\n+ assert_equal 2, templates.size, \"expected two templates\"\n+ assert_equal \"Another template!\", templates[0].source\n+ assert_equal \"custom_pattern/another\", templates[0].virtual_path\n+ assert_equal \"Hello custom patterns!\", templates[1].source\n+ assert_equal \"custom_pattern/another\", templates[1].virtual_path\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:52 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 14:24:59 GMT",
etag = "\"3bb721109d004b4102ad5342b662ae1e\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248503:54D90240",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "2811da37fbdda4367181b328b22b2499"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "17e1eb3126ee7cc2c5ca1a0c8de3369f697c5921", filename = "railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb",
status = "modified", additions = 13L, deletions = 49L, changes = 62L,
blob_url = "https://github.com/rails/rails/blob/f7e31e11d137ff3442bea09d405e63c4007e79f2/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb",
raw_url = "https://github.com/rails/rails/raw/f7e31e11d137ff3442bea09d405e63c4007e79f2/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb?ref=f7e31e11d137ff3442bea09d405e63c4007e79f2",
patch = "@@ -1,85 +1,49 @@\n <% module_namespacing do -%>\n class <%= controller_class_name %>Controller < ApplicationController\n- # GET <%= route_url %>\n- # GET <%= route_url %>.xml\n+ respond_to :html, :xml\n+\n def index\n @<%= plural_table_name %> = <%= orm_class.all(class_name) %>\n-\n- respond_to do |format|\n- format.html # index.html.erb\n- format.xml { render :xml => @<%= plural_table_name %> }\n- end\n+ respond_with(@<%= plural_table_name %>)\n end\n \n- # GET <%= route_url %>/1\n- # GET <%= route_url %>/1.xml\n def show\n @<%= singular_table_name %> = <%= orm_class.find(class_name, \"params[:id]\") %>\n-\n- respond_to do |format|\n- format.html # show.html.erb\n- format.xml { render :xml => @<%= singular_table_name %> }\n- end\n+ respond_with(@<%= singular_table_name %>)\n end\n \n- # GET <%= route_url %>/new\n- # GET <%= route_url %>/new.xml\n def new\n @<%= singular_table_name %> = <%= orm_class.build(class_name) %>\n-\n- respond_to do |format|\n- format.html # new.html.erb\n- format.xml { render :xml => @<%= singular_table_name %> }\n- end\n+ respond_with(@<%= singular_table_name %>)\n end\n \n- # GET <%= route_url %>/1/edit\n def edit\n @<%= singular_table_name %> = <%= orm_class.find(class_name, \"params[:id]\") %>\n+ respond_with(@<%= singular_table_name %>)\n end\n \n- # POST <%= route_url %>\n- # POST <%= route_url %>.xml\n def create\n @<%= singular_table_name %> = <%= orm_class.build(class_name, \"params[:#{singular_table_name}]\") %>\n \n- respond_to do |format|\n- if @<%= orm_instance.save %>\n- format.html { redirect_to(@<%= singular_table_name %>, :notice => '<%= human_name %> was successfully created.') }\n- format.xml { render :xml => @<%= singular_table_name %>, :status => :created, :location => @<%= singular_table_name %> }\n- else\n- format.html { render :action => \"new\" }\n- format.xml { render :xml => @<%= orm_instance.errors %>, :status => :unprocessable_entity }\n- end\n+ if @<%= orm_instance.save %>\n+ flash[:notice] = \"<%= human_name %> successfully created.\"\n end\n+ respond_with(@<%= singular_table_name %>)\n end\n \n- # PUT <%= route_url %>/1\n- # PUT <%= route_url %>/1.xml\n def update\n @<%= singular_table_name %> = <%= orm_class.find(class_name, \"params[:id]\") %>\n \n- respond_to do |format|\n- if @<%= orm_instance.update_attributes(\"params[:#{singular_table_name}]\") %>\n- format.html { redirect_to(@<%= singular_table_name %>, :notice => '<%= human_name %> was successfully updated.') }\n- format.xml { head :ok }\n- else\n- format.html { render :action => \"edit\" }\n- format.xml { render :xml => @<%= orm_instance.errors %>, :status => :unprocessable_entity }\n- end\n+ if @<%= orm_instance.update_attributes(\"params[:#{singular_table_name}]\") %>\n+ flash[:notice] = \"<%= human_name %> successfully created.\"\n end\n+ respond_with(@<%= singular_table_name %>)\n end\n \n- # DELETE <%= route_url %>/1\n- # DELETE <%= route_url %>/1.xml\n def destroy\n @<%= singular_table_name %> = <%= orm_class.find(class_name, \"params[:id]\") %>\n @<%= orm_instance.destroy %>\n-\n- respond_to do |format|\n- format.html { redirect_to(<%= index_helper %>_url) }\n- format.xml { head :ok }\n- end\n+ respond_with(@<%= singular_table_name %>)\n end\n end\n <% end -%>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "09d6d0bbff3027ebc355ec917b279179d8c051a3",
filename = "railties/test/generators/scaffold_controller_generator_test.rb",
status = "modified", additions = 0L, deletions = 2L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/f7e31e11d137ff3442bea09d405e63c4007e79f2/railties/test/generators/scaffold_controller_generator_test.rb",
raw_url = "https://github.com/rails/rails/raw/f7e31e11d137ff3442bea09d405e63c4007e79f2/railties/test/generators/scaffold_controller_generator_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/generators/scaffold_controller_generator_test.rb?ref=f7e31e11d137ff3442bea09d405e63c4007e79f2",
patch = "@@ -35,13 +35,11 @@ def test_controller_skeleton_is_created\n assert_instance_method :create, content do |m|\n assert_match /@user = User\\.new\\(params\\[:user\\]\\)/, m\n assert_match /@user\\.save/, m\n- assert_match /@user\\.errors/, m\n end\n \n assert_instance_method :update, content do |m|\n assert_match /@user = User\\.find\\(params\\[:id\\]\\)/, m\n assert_match /@user\\.update_attributes\\(params\\[:user\\]\\)/, m\n- assert_match /@user\\.errors/, m\n end\n \n assert_instance_method :destroy, content do |m|"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:53 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Fri, 23 Jan 2015 18:40:11 GMT",
etag = "\"70ee6db42b52b72d2966c944cc435bf0\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248533:54D90240",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "d594a23ec74671eba905bf91ef329026"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "59211d1c1da5ee34365e3055b5f144d94e333de0", filename = "actionpack/CHANGELOG",
status = "modified", additions = 8L, deletions = 0L, changes = 8L,
blob_url = "https://github.com/rails/rails/blob/2cb6c5545e828d1b1b10445151f5a44691ed2e18/actionpack/CHANGELOG",
raw_url = "https://github.com/rails/rails/raw/2cb6c5545e828d1b1b10445151f5a44691ed2e18/actionpack/CHANGELOG",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/CHANGELOG?ref=2cb6c5545e828d1b1b10445151f5a44691ed2e18",
patch = "@@ -1,5 +1,13 @@\n *Rails 3.1.0 (unreleased)*\n \n+* Wildcard route will always matching the optional format segment by default. For example if you have this route:\n+\n+ map '*pages' => 'pages#show'\n+\n+ by requesting '/foo/bar.json', your `params[:pages]` will be equals to \"foo/bar\" with the request format of JSON. If you want the old 3.0.x behavior back, you could supply `:format => false` like this:\n+\n+ map '*pages' => 'pages#show', :format => false\n+\n * Allow you to add `force_ssl` into controller to force browser to transfer data via HTTPS protocol on that particular controller. You can also specify `:only` or `:except` to specific it to particular action. [DHH and Prem Sichanugrist]\n \n * Allow FormHelper#form_for to specify the :method as a direct option instead of through the :html hash [DHH]"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "651f3b164ac66e4e9bbc3fe7f9fd290bb8c840da",
filename = "actionpack/actionpack.gemspec", status = "modified",
additions = 1L, deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/2cb6c5545e828d1b1b10445151f5a44691ed2e18/actionpack/actionpack.gemspec",
raw_url = "https://github.com/rails/rails/raw/2cb6c5545e828d1b1b10445151f5a44691ed2e18/actionpack/actionpack.gemspec",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/actionpack.gemspec?ref=2cb6c5545e828d1b1b10445151f5a44691ed2e18",
patch = "@@ -26,7 +26,7 @@ Gem::Specification.new do |s|\n s.add_dependency('i18n', '~> 0.5.0')\n s.add_dependency('rack', '~> 1.2.1')\n s.add_dependency('rack-test', '~> 0.5.7')\n- s.add_dependency('rack-mount', '~> 0.6.13')\n+ s.add_dependency('rack-mount', '~> 0.7.1')\n s.add_dependency('tzinfo', '~> 0.3.23')\n s.add_dependency('erubis', '~> 2.6.6')\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "35be0b3a27982e263885a4a693a4128baf1b8e24",
filename = "actionpack/lib/action_dispatch/routing/mapper.rb",
status = "modified", additions = 7L, deletions = 1L, changes = 8L,
blob_url = "https://github.com/rails/rails/blob/2cb6c5545e828d1b1b10445151f5a44691ed2e18/actionpack/lib/action_dispatch/routing/mapper.rb",
raw_url = "https://github.com/rails/rails/raw/2cb6c5545e828d1b1b10445151f5a44691ed2e18/actionpack/lib/action_dispatch/routing/mapper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_dispatch/routing/mapper.rb?ref=2cb6c5545e828d1b1b10445151f5a44691ed2e18",
patch = "@@ -104,10 +104,16 @@ def normalize_path(path)\n @options.reverse_merge!(:controller => /.+?/)\n end\n \n+ # Add a constraint for wildcard route to make it non-greedy and match the\n+ # optional format part of the route by default\n+ if path.match(/\\*([^\\/]+)$/) && @options[:format] != false\n+ @options.reverse_merge!(:\"#{$1}\" => /.+?/)\n+ end\n+\n if @options[:format] == false\n @options.delete(:format)\n path\n- elsif path.include?(\":format\") || path.end_with?('/') || path.match(/^\\/?\\*/)\n+ elsif path.include?(\":format\") || path.end_with?('/')\n path\n else\n \"#{path}(.:format)\""), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "f90de735b6f14ed7a05a57c562e6ecabec723a63",
filename = "actionpack/test/dispatch/mapper_test.rb", status = "renamed",
additions = 31L, deletions = 1L, changes = 32L, blob_url = "https://github.com/rails/rails/blob/2cb6c5545e828d1b1b10445151f5a44691ed2e18/actionpack/test/dispatch/mapper_test.rb",
raw_url = "https://github.com/rails/rails/raw/2cb6c5545e828d1b1b10445151f5a44691ed2e18/actionpack/test/dispatch/mapper_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/dispatch/mapper_test.rb?ref=2cb6c5545e828d1b1b10445151f5a44691ed2e18",
patch = "@@ -25,6 +25,10 @@ def add_route(*args)\n def conditions\n routes.map { |x| x[1] }\n end\n+\n+ def requirements\n+ routes.map { |x| x[2] }\n+ end\n end\n \n def test_initialize\n@@ -50,8 +54,34 @@ def test_map_more_slashes\n def test_map_wildcard\n fakeset = FakeSet.new\n mapper = Mapper.new fakeset\n- mapper.match '/*path', :to => 'pages#show', :as => :page\n+ mapper.match '/*path', :to => 'pages#show'\n+ assert_equal '/*path(.:format)', fakeset.conditions.first[:path_info]\n+ assert_equal /.+?/, fakeset.requirements.first[:path]\n+ end\n+\n+ def test_map_wildcard_with_other_element\n+ fakeset = FakeSet.new\n+ mapper = Mapper.new fakeset\n+ mapper.match '/*path/foo/:bar', :to => 'pages#show'\n+ assert_equal '/*path/foo/:bar(.:format)', fakeset.conditions.first[:path_info]\n+ assert_nil fakeset.requirements.first[:path]\n+ end\n+\n+ def test_map_wildcard_with_multiple_wildcard\n+ fakeset = FakeSet.new\n+ mapper = Mapper.new fakeset\n+ mapper.match '/*foo/*bar', :to => 'pages#show'\n+ assert_equal '/*foo/*bar(.:format)', fakeset.conditions.first[:path_info]\n+ assert_nil fakeset.requirements.first[:foo]\n+ assert_equal /.+?/, fakeset.requirements.first[:bar]\n+ end\n+\n+ def test_map_wildcard_with_format_false\n+ fakeset = FakeSet.new\n+ mapper = Mapper.new fakeset\n+ mapper.match '/*path', :to => 'pages#show', :format => false\n assert_equal '/*path', fakeset.conditions.first[:path_info]\n+ assert_nil fakeset.requirements.first[:path]\n end\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "58b75b9a1d659665ad53c80440ed4eb09080e96f",
filename = "railties/guides/source/routing.textile", status = "modified",
additions = 12L, deletions = 0L, changes = 12L, blob_url = "https://github.com/rails/rails/blob/2cb6c5545e828d1b1b10445151f5a44691ed2e18/railties/guides/source/routing.textile",
raw_url = "https://github.com/rails/rails/raw/2cb6c5545e828d1b1b10445151f5a44691ed2e18/railties/guides/source/routing.textile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/guides/source/routing.textile?ref=2cb6c5545e828d1b1b10445151f5a44691ed2e18",
patch = "@@ -557,6 +557,18 @@ match '*a/foo/*b' => 'test#index'\n \n would match +zoo/woo/foo/bar/baz+ with +params[:a]+ equals +\"zoo/woo\"+, and +params[:b]+ equals +\"bar/baz\"+.\n \n+NOTE: Starting from Rails 3.1, wildcard route will always matching the optional format segment by default. For example if you have this route:\n+\n+<ruby>\n+map '*pages' => 'pages#show'\n+</ruby>\n+\n+NOTE: By requesting +\"/foo/bar.json\"+, your +params[:pages]+ will be equals to +\"foo/bar\"+ with the request format of JSON. If you want the old 3.0.x behavior back, you could supply +:format => false+ like this:\n+\n+<ruby>\n+map '*pages' => 'pages#show', :format => false\n+</ruby>\n+\n h4. Redirection\n \n You can redirect any path to another path using the +redirect+ helper in your router:"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:53 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:48:06 GMT",
etag = "\"03a20c25e0d402a34880ef6d6a23fbfe\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24855C:54D90241",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "7f48e2f7761567e923121f17538d7a6d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "1d2ee87fff97345df9a60fc76dbd1ed109206212", filename = "actionpack/lib/action_controller/session/abstract_store.rb",
status = "modified", additions = 1L, deletions = 0L, changes = 1L,
blob_url = "https://github.com/rails/rails/blob/7686c6ec4b11c3b0f41f9b01b75f84002dee43de/actionpack/lib/action_controller/session/abstract_store.rb",
raw_url = "https://github.com/rails/rails/raw/7686c6ec4b11c3b0f41f9b01b75f84002dee43de/actionpack/lib/action_controller/session/abstract_store.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_controller/session/abstract_store.rb?ref=7686c6ec4b11c3b0f41f9b01b75f84002dee43de",
patch = "@@ -196,6 +196,7 @@ def call(env)\n \n if (request_cookies.nil? || request_cookies[@key] != sid) || options[:expire_after]\n cookie = {:value => sid}\n+ cookie[:expires] = Time.now + options[:expire_after] if options[:expire_after]\n Rack::Utils.set_cookie_header!(response[1], @key, cookie.merge(options))\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "2df66a2e16bb6ddd2bd46732aa602215f4990721",
filename = "actionpack/test/controller/session/abstract_store_test.rb",
status = "added", additions = 64L, deletions = 0L, changes = 64L,
blob_url = "https://github.com/rails/rails/blob/7686c6ec4b11c3b0f41f9b01b75f84002dee43de/actionpack/test/controller/session/abstract_store_test.rb",
raw_url = "https://github.com/rails/rails/raw/7686c6ec4b11c3b0f41f9b01b75f84002dee43de/actionpack/test/controller/session/abstract_store_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/controller/session/abstract_store_test.rb?ref=7686c6ec4b11c3b0f41f9b01b75f84002dee43de",
patch = "@@ -0,0 +1,64 @@\n+require 'abstract_unit'\n+\n+# You need to start a memcached server inorder to run these tests\n+class AbstractStoreTest < ActionController::IntegrationTest\n+ SessionKey = '_myapp_session'\n+ DispatcherApp = ActionController::Dispatcher.new\n+\n+ class TestController < ActionController::Base\n+ def get_session\n+ session[:test] = 'test'\n+ head :ok\n+ end\n+ end\n+\n+ def test_expiry_after\n+ with_test_route_set(:expire_after => 5 * 60) do\n+ get 'get_session'\n+ assert_response :success\n+ assert_match /expires=\\S+/, headers['Set-Cookie']\n+ end\n+ end\n+\n+protected\n+\n+ def with_test_route_set(options = {})\n+ with_routing do |set|\n+ set.draw do |map|\n+ map.with_options :controller => \"abstract_store_test/test\" do |c|\n+ c.connect \"/:action\"\n+ end\n+ end\n+\n+ options = { :key => SessionKey, :secret => 'SessionSecret' }.merge!(options)\n+ @integration_session = open_session(TestStore.new(DispatcherApp, options))\n+\n+ yield\n+ end\n+ end\n+\n+ class TestStore < ActionController::Session::AbstractStore\n+ def initialize(app, options = {})\n+ super\n+ @_store = Hash.new({})\n+ end\n+\n+ private\n+\n+ def get_session(env, sid)\n+ sid ||= generate_sid\n+ session = @_store[sid]\n+ [sid, session]\n+ end\n+\n+ def set_session(env, sid, session_data)\n+ @_store[sid] = session_data\n+ end\n+\n+ def destroy(env)\n+ @_store.delete(sid)\n+ end\n+ end\n+\n+end\n+"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:53 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 16:02:35 GMT",
etag = "\"a4a3eab79ffd130be07f489d5d89e17e\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24858A:54D90241",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "07ff1c8a09e44b62e277fae50a1b1dc4"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:53 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Thu, 29 Jan 2015 11:49:00 GMT",
etag = "\"6788d38a392a059b991df23d3c866fed\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2485B0:54D90241",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "b0ef53392caa42315c6206737946d931"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "90faad613168a80faf6e54da5b43426392652e97", filename = "railties/CHANGELOG",
status = "modified", additions = 14L, deletions = 0L, changes = 14L,
blob_url = "https://github.com/rails/rails/blob/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/CHANGELOG",
raw_url = "https://github.com/rails/rails/raw/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/CHANGELOG",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/CHANGELOG?ref=a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7",
patch = "@@ -1,5 +1,19 @@\n *Rails 3.1.0 (unreleased)*\n \n+* Changed scaffold and app generator to create Ruby 1.9 style hash when running on Ruby 1.9 [Prem Sichanugrist]\n+\n+ So instead of creating something like:\n+\n+ redirect_to users_path, :notice => \"User has been created\"\n+\n+ it will now be like this:\n+\n+ redirect_to users_path, notice: \"User has been created\"\n+\n+ You can also passing `--old-style-hash` to make Rails generate old style hash even you're on Ruby 1.9\n+\n+* Changed scaffold_controller generator to create format block for JSON instead of XML [Prem Sichanugrist]\n+\n * Add using Turn with natural language test case names for test_help.rb when running with minitest (Ruby 1.9.2+) [DHH]\n \n * Direct logging of Active Record to STDOUT so it's shown inline with the results in the console [DHH]"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "93db5106ce0bcc6f4f500dd0224044d1dfda984b",
filename = "railties/lib/rails/generators/app_base.rb", status = "modified",
additions = 12L, deletions = 0L, changes = 12L, blob_url = "https://github.com/rails/rails/blob/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/lib/rails/generators/app_base.rb",
raw_url = "https://github.com/rails/rails/raw/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/lib/rails/generators/app_base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/app_base.rb?ref=a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7",
patch = "@@ -53,6 +53,9 @@ def self.add_shared_options_for(name)\n \n class_option :help, :type => :boolean, :aliases => \"-h\", :group => :rails,\n :desc => \"Show this help message and quit\"\n+\n+ class_option :old_style_hash, :type => :boolean, :default => false,\n+ :desc => \"Force using old style hash (:foo => 'bar') on Ruby >= 1.9\"\n end\n \n def initialize(*args)\n@@ -174,6 +177,15 @@ def empty_directory_with_gitkeep(destination, config = {})\n create_file(\"#{destination}/.gitkeep\") unless options[:skip_git]\n end\n \n+ # Returns Ruby 1.9 style key-value pair if current code is running on\n+ # Ruby 1.9.x. Returns the old-style (with hash rocket) otherwise.\n+ def key_value(key, value)\n+ if options[:old_style_hash] || RUBY_VERSION < '1.9'\n+ \":#{key} => #{value}\"\n+ else\n+ \"#{key}: #{value}\"\n+ end\n+ end\n end\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "a7393cfe18608743b43bf9b2b54b699c784edb34",
filename = "railties/lib/rails/generators/erb/scaffold/templates/index.html.erb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb",
raw_url = "https://github.com/rails/rails/raw/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb?ref=a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7",
patch = "@@ -17,7 +17,7 @@\n <% end -%>\n <td><%%= link_to 'Show', <%= singular_table_name %> %></td>\n <td><%%= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>) %></td>\n- <td><%%= link_to 'Destroy', <%= singular_table_name %>, :confirm => 'Are you sure?', :method => :delete %></td>\n+ <td><%%= link_to 'Destroy', <%= singular_table_name %>, <%= key_value :confirm, \"'Are you sure?'\" %>, <%= key_value :method, \":delete\" %> %></td>\n </tr>\n <%% end %>\n </table>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "36bc9e055c0dfe7c306e4ae51529da1d31f4ae96",
filename = "railties/lib/rails/generators/named_base.rb",
status = "modified", additions = 13L, deletions = 0L, changes = 13L,
blob_url = "https://github.com/rails/rails/blob/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/lib/rails/generators/named_base.rb",
raw_url = "https://github.com/rails/rails/raw/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/lib/rails/generators/named_base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/named_base.rb?ref=a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7",
patch = "@@ -8,6 +8,9 @@ class NamedBase < Base\n class_option :skip_namespace, :type => :boolean, :default => false,\n :desc => \"Skip namespace (affects only isolated applications)\"\n \n+ class_option :old_style_hash, :type => :boolean, :default => false,\n+ :desc => \"Force using old style hash (:foo => 'bar') on Ruby >= 1.9\"\n+\n def initialize(args, *options) #:nodoc:\n # Unfreeze name in case it's given as a frozen string\n args[0] = args[0].dup if args[0].is_a?(String) && args[0].frozen?\n@@ -181,6 +184,16 @@ def self.check_class_collision(options={})\n class_collisions \"#{options[:prefix]}#{name}#{options[:suffix]}\"\n end\n end\n+\n+ # Returns Ruby 1.9 style key-value pair if current code is running on\n+ # Ruby 1.9.x. Returns the old-style (with hash rocket) otherwise.\n+ def key_value(key, value)\n+ if options[:old_style_hash] || RUBY_VERSION < '1.9'\n+ \":#{key} => #{value}\"\n+ else\n+ \"#{key}: #{value}\"\n+ end\n+ end\n end\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ddfe4ba1e1d36c2a06a86802f16609658ef47051",
filename = "railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt",
raw_url = "https://github.com/rails/rails/raw/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt?ref=a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7",
patch = "@@ -1,6 +1,6 @@\n # Be sure to restart your server when you modify this file.\n \n-<%= app_const %>.config.session_store :cookie_store, :key => '_<%= app_name %>_session'\n+<%= app_const %>.config.session_store :cookie_store, <%= key_value :key, \"'_#{app_name}_session'\" %>\n \n # Use the database for sessions instead of the cookie-based default,\n # which shouldn't be used to store highly confidential information"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "9a2efa68a7a8b18e4f8d62f2f95b727c9b4e0ac1",
filename = "railties/lib/rails/generators/rails/app/templates/db/seeds.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/lib/rails/generators/rails/app/templates/db/seeds.rb",
raw_url = "https://github.com/rails/rails/raw/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/lib/rails/generators/rails/app/templates/db/seeds.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/db/seeds.rb?ref=a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7",
patch = "@@ -3,5 +3,5 @@\n #\n # Examples:\n #\n-# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])\n-# Mayor.create(:name => 'Daley', :city => cities.first)\n+# cities = City.create([{ <%= key_value :name, \"'Chicago'\" %> }, { <%= key_value :name, \"'Copenhagen'\" %> }])\n+# Mayor.create(<%= key_value :name, \"'Daley'\" %>, <%= key_value :city, \"cities.first\" %>)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "a8a1c07d1fb0865034d73d111811d2a438d79ef1",
filename = "railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb",
status = "modified", additions = 19L, deletions = 19L, changes = 38L,
blob_url = "https://github.com/rails/rails/blob/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb",
raw_url = "https://github.com/rails/rails/raw/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb?ref=a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7",
patch = "@@ -1,35 +1,35 @@\n <% module_namespacing do -%>\n class <%= controller_class_name %>Controller < ApplicationController\n # GET <%= route_url %>\n- # GET <%= route_url %>.xml\n+ # GET <%= route_url %>.json\n def index\n @<%= plural_table_name %> = <%= orm_class.all(class_name) %>\n \n respond_to do |format|\n format.html # index.html.erb\n- format.xml { render :xml => @<%= plural_table_name %> }\n+ format.json { render <%= key_value :json, \"@#{plural_table_name}\" %> }\n end\n end\n \n # GET <%= route_url %>/1\n- # GET <%= route_url %>/1.xml\n+ # GET <%= route_url %>/1.json\n def show\n @<%= singular_table_name %> = <%= orm_class.find(class_name, \"params[:id]\") %>\n \n respond_to do |format|\n format.html # show.html.erb\n- format.xml { render :xml => @<%= singular_table_name %> }\n+ format.json { render <%= key_value :json, \"@#{singular_table_name}\" %> }\n end\n end\n \n # GET <%= route_url %>/new\n- # GET <%= route_url %>/new.xml\n+ # GET <%= route_url %>/new.json\n def new\n @<%= singular_table_name %> = <%= orm_class.build(class_name) %>\n \n respond_to do |format|\n format.html # new.html.erb\n- format.xml { render :xml => @<%= singular_table_name %> }\n+ format.json { render <%= key_value :json, \"@#{singular_table_name}\" %> }\n end\n end\n \n@@ -39,46 +39,46 @@ def edit\n end\n \n # POST <%= route_url %>\n- # POST <%= route_url %>.xml\n+ # POST <%= route_url %>.json\n def create\n @<%= singular_table_name %> = <%= orm_class.build(class_name, \"params[:#{singular_table_name}]\") %>\n \n respond_to do |format|\n if @<%= orm_instance.save %>\n- format.html { redirect_to(@<%= singular_table_name %>, :notice => '<%= human_name %> was successfully created.') }\n- format.xml { render :xml => @<%= singular_table_name %>, :status => :created, :location => @<%= singular_table_name %> }\n+ format.html { redirect_to @<%= singular_table_name %>, <%= key_value :notice, \"'#{human_name} was successfully created.'\" %> }\n+ format.json { render <%= key_value :json, \"@#{singular_table_name}\" %>, <%= key_value :status, ':created' %>, <%= key_value :location, \"@#{singular_table_name}\" %> }\n else\n- format.html { render :action => \"new\" }\n- format.xml { render :xml => @<%= orm_instance.errors %>, :status => :unprocessable_entity }\n+ format.html { render <%= key_value :action, '\"new\"' %> }\n+ format.json { render <%= key_value :json, \"@#{orm_instance.errors}\" %>, <%= key_value :status, ':unprocessable_entity' %> }\n end\n end\n end\n \n # PUT <%= route_url %>/1\n- # PUT <%= route_url %>/1.xml\n+ # PUT <%= route_url %>/1.json\n def update\n @<%= singular_table_name %> = <%= orm_class.find(class_name, \"params[:id]\") %>\n \n respond_to do |format|\n if @<%= orm_instance.update_attributes(\"params[:#{singular_table_name}]\") %>\n- format.html { redirect_to(@<%= singular_table_name %>, :notice => '<%= human_name %> was successfully updated.') }\n- format.xml { head :ok }\n+ format.html { redirect_to @<%= singular_table_name %>, <%= key_value :notice, \"'#{human_name} was successfully updated.'\" %> }\n+ format.json { render <%= key_value :json, '{}' %>, <%= key_value :status, ':ok' %> }\n else\n- format.html { render :action => \"edit\" }\n- format.xml { render :xml => @<%= orm_instance.errors %>, :status => :unprocessable_entity }\n+ format.html { render <%= key_value :action, '\"edit\"' %> }\n+ format.json { render <%= key_value :json, \"@#{orm_instance.errors}\" %>, <%= key_value :status, ':unprocessable_entity' %> }\n end\n end\n end\n \n # DELETE <%= route_url %>/1\n- # DELETE <%= route_url %>/1.xml\n+ # DELETE <%= route_url %>/1.json\n def destroy\n @<%= singular_table_name %> = <%= orm_class.find(class_name, \"params[:id]\") %>\n @<%= orm_instance.destroy %>\n \n respond_to do |format|\n- format.html { redirect_to(<%= index_helper %>_url) }\n- format.xml { head :ok }\n+ format.html { redirect_to <%= index_helper %>_url }\n+ format.json { render <%= key_value :json, '{}' %>, <%= key_value :status, ':ok' %> }\n end\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "01fe6dda7a2eef1720e2b6a0a89005a626ef1689",
filename = "railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb",
status = "modified", additions = 5L, deletions = 5L, changes = 10L,
blob_url = "https://github.com/rails/rails/blob/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb",
raw_url = "https://github.com/rails/rails/raw/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb?ref=a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7",
patch = "@@ -19,30 +19,30 @@ class <%= controller_class_name %>ControllerTest < ActionController::TestCase\n \n test \"should create <%= singular_table_name %>\" do\n assert_difference('<%= class_name %>.count') do\n- post :create, :<%= singular_table_name %> => @<%= singular_table_name %>.attributes\n+ post :create, <%= key_value singular_table_name, \"@#{singular_table_name}.attributes\" %>\n end\n \n assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>))\n end\n \n test \"should show <%= singular_table_name %>\" do\n- get :show, :id => @<%= singular_table_name %>.to_param\n+ get :show, <%= key_value :id, \"@#{singular_table_name}.to_param\" %>\n assert_response :success\n end\n \n test \"should get edit\" do\n- get :edit, :id => @<%= singular_table_name %>.to_param\n+ get :edit, <%= key_value :id, \"@#{singular_table_name}.to_param\" %>\n assert_response :success\n end\n \n test \"should update <%= singular_table_name %>\" do\n- put :update, :id => @<%= singular_table_name %>.to_param, :<%= singular_table_name %> => @<%= singular_table_name %>.attributes\n+ put :update, <%= key_value :id, \"@#{singular_table_name}.to_param\" %>, <%= key_value singular_table_name, \"@#{singular_table_name}.attributes\" %>\n assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>))\n end\n \n test \"should destroy <%= singular_table_name %>\" do\n assert_difference('<%= class_name %>.count', -1) do\n- delete :destroy, :id => @<%= singular_table_name %>.to_param\n+ delete :destroy, <%= key_value :id, \"@#{singular_table_name}.to_param\" %>\n end\n \n assert_redirected_to <%= index_helper %>_path"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "43f2fbd71c99045b6bfcc2b4c6a79c3e732d0db2",
filename = "railties/test/generators/app_generator_test.rb",
status = "modified", additions = 18L, deletions = 0L, changes = 18L,
blob_url = "https://github.com/rails/rails/blob/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/test/generators/app_generator_test.rb",
raw_url = "https://github.com/rails/rails/raw/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/test/generators/app_generator_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/generators/app_generator_test.rb?ref=a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7",
patch = "@@ -216,6 +216,24 @@ def test_test_unit_is_removed_from_frameworks_if_skip_test_unit_is_given\n end\n end\n \n+ def test_new_hash_style\n+ run_generator [destination_root]\n+ assert_file \"config/initializers/session_store.rb\" do |file|\n+ if RUBY_VERSION < \"1.9\"\n+ assert_match /config.session_store :cookie_store, :key => '_.+_session'/, file\n+ else\n+ assert_match /config.session_store :cookie_store, key: '_.+_session'/, file\n+ end\n+ end\n+ end\n+\n+ def test_force_old_style_hash\n+ run_generator [destination_root, \"--old-style-hash\"]\n+ assert_file \"config/initializers/session_store.rb\" do |file|\n+ assert_match /config.session_store :cookie_store, :key => '_.+_session'/, file\n+ end\n+ end\n+\n protected\n \n def action(*args, &block)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c7f45a807d27b9c2414c663a004bf166036127b7",
filename = "railties/test/generators/scaffold_controller_generator_test.rb",
status = "modified", additions = 18L, deletions = 0L, changes = 18L,
blob_url = "https://github.com/rails/rails/blob/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/test/generators/scaffold_controller_generator_test.rb",
raw_url = "https://github.com/rails/rails/raw/a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7/railties/test/generators/scaffold_controller_generator_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/generators/scaffold_controller_generator_test.rb?ref=a1a510dbd62569dab3ae5ae9a298bb245f7b8ab7",
patch = "@@ -122,4 +122,22 @@ def self.all(klass)\n ensure\n Unknown::Generators.send :remove_const, :ActiveModel\n end\n+\n+ def test_new_hash_style\n+ run_generator\n+ assert_file \"app/controllers/users_controller.rb\" do |content|\n+ if RUBY_VERSION < \"1.9\"\n+ assert_match /\\{ render :action => \"new\" \\}/, content\n+ else\n+ assert_match /\\{ render action: \"new\" \\}/, content\n+ end\n+ end\n+ end\n+\n+ def test_force_old_style_hash\n+ run_generator [\"User\", \"--old-style-hash\"]\n+ assert_file \"app/controllers/users_controller.rb\" do |content|\n+ assert_match /\\{ render :action => \"new\" \\}/, content\n+ end\n+ end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:53 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:48:06 GMT",
etag = "\"5522c9a2858e75b01f6add0dbbc4dc1d\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2485C6:54D90241",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "c6c65e5196703428e7641f7d1e9bc353"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "d6f0456698b90c307d08875d4ae1ff536733e9b2", filename = "activemodel/lib/active_model/secure_password.rb",
status = "modified", additions = 1L, deletions = 2L, changes = 3L,
blob_url = "https://github.com/rails/rails/blob/763d1c2073d5e6689f90e0d8df5bf54b651699c6/activemodel/lib/active_model/secure_password.rb",
raw_url = "https://github.com/rails/rails/raw/763d1c2073d5e6689f90e0d8df5bf54b651699c6/activemodel/lib/active_model/secure_password.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/lib/active_model/secure_password.rb?ref=763d1c2073d5e6689f90e0d8df5bf54b651699c6",
patch = "@@ -31,11 +31,10 @@ module ClassMethods\n # User.find_by_name(\"david\").try(:authenticate, \"mUc3m00RsqyRe\") # => user\n def has_secure_password\n attr_reader :password\n- attr_accessor :password_confirmation\n \n validates_confirmation_of :password\n validates_presence_of :password_digest\n- \n+\n include InstanceMethodsOnActivation\n \n if respond_to?(:attributes_protected_by_default)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:53 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 14:38:54 GMT",
etag = "\"5160bf1fc1a4a892ab5ade70dcb8dc09\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2485DE:54D90241",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "01d096e6cfe28f8aea352e988c332cd3"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "d1b87b67eeae6dce8762c2c067a3d3c81171088d", filename = "actionpack/lib/abstract_controller/layouts.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/ed81f456633250953fcd7b93a722fb74c1755f10/actionpack/lib/abstract_controller/layouts.rb",
raw_url = "https://github.com/rails/rails/raw/ed81f456633250953fcd7b93a722fb74c1755f10/actionpack/lib/abstract_controller/layouts.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/abstract_controller/layouts.rb?ref=ed81f456633250953fcd7b93a722fb74c1755f10",
patch = "@@ -334,7 +334,7 @@ def _layout_for_option(name)\n # ==== Parameters\n # * <tt>details</tt> - A list of details to restrict the search by. This\n # might include details like the format or locale of the template.\n- # * <tt>require_logout</tt> - If this is true, raise an ArgumentError\n+ # * <tt>require_layout</tt> - If this is true, raise an ArgumentError\n # with details about the fact that the exception could not be\n # found (defaults to false)\n #"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:53 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Thu, 05 Feb 2015 22:17:37 GMT",
etag = "\"c250e1199c37da113f70c9f958348087\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2485F5:54D90241",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "b0ef53392caa42315c6206737946d931"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "404c25796dc3b780890e6176d7053deb7595d5ff", filename = "activesupport/lib/active_support/core_ext/hash/conversions.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/dc828bdb77a9629a3dece601677d8a8b5d41e1cc/activesupport/lib/active_support/core_ext/hash/conversions.rb",
raw_url = "https://github.com/rails/rails/raw/dc828bdb77a9629a3dece601677d8a8b5d41e1cc/activesupport/lib/active_support/core_ext/hash/conversions.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/lib/active_support/core_ext/hash/conversions.rb?ref=dc828bdb77a9629a3dece601677d8a8b5d41e1cc",
patch = "@@ -96,7 +96,7 @@ def typecast_xml_value(value)\n raise \"can't typecast #{entries.inspect}\"\n end\n end\n- elsif value.has_key?(\"__content__\")\n+ elsif value['type'] == 'file' || value[\"__content__\"].present?\n content = value[\"__content__\"]\n if parser = ActiveSupport::XmlMini::PARSING[value[\"type\"]]\n parser.arity == 1 ? parser.call(content) : parser.call(content, value)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "00e4424b52c0d109114cf8516281cf0ce3502e03",
filename = "activesupport/test/core_ext/hash_ext_test.rb",
status = "modified", additions = 9L, deletions = 0L, changes = 9L,
blob_url = "https://github.com/rails/rails/blob/dc828bdb77a9629a3dece601677d8a8b5d41e1cc/activesupport/test/core_ext/hash_ext_test.rb",
raw_url = "https://github.com/rails/rails/raw/dc828bdb77a9629a3dece601677d8a8b5d41e1cc/activesupport/test/core_ext/hash_ext_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/test/core_ext/hash_ext_test.rb?ref=dc828bdb77a9629a3dece601677d8a8b5d41e1cc",
patch = "@@ -857,6 +857,15 @@ def test_file_from_xml_with_defaults\n assert_equal 'application/octet-stream', file.content_type\n end\n \n+ def test_tag_with_attrs_and_whitespace\n+ xml = <<-XML\n+ <blog name=\"bacon is the best\">\n+ </blog>\n+ XML\n+ hash = Hash.from_xml(xml)\n+ assert_equal \"bacon is the best\", hash['blog']['name']\n+ end\n+\n def test_xsd_like_types_from_xml\n bacon_xml = <<-EOT\n <bacon>"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:53 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 16:05:21 GMT",
etag = "\"442d299422a4d72b68fd50148995b37d\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248610:54D90241",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "318e55760cf7cdb40e61175a4d36cd32"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "5d649db4a2a9dc8402708be14528b2c7c2b8c10d", filename = "Gemfile",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/34113a6496802d9eb2c5b938bef0ed04cbab5ee8/Gemfile",
raw_url = "https://github.com/rails/rails/raw/34113a6496802d9eb2c5b938bef0ed04cbab5ee8/Gemfile",
contents_url = "https://api.github.com/repos/rails/rails/contents/Gemfile?ref=34113a6496802d9eb2c5b938bef0ed04cbab5ee8",
patch = "@@ -59,7 +59,7 @@ end\n \n platforms :jruby do\n gem \"ruby-debug\", \">= 0.10.3\"\n-\n+ gem 'json'\n gem \"activerecord-jdbcsqlite3-adapter\"\n \n # This is needed by now to let tests work on JRuby"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:54 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:59:45 GMT",
etag = "\"76b8887b3b5e9f4074f0720a33ba30ab\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248629:54D90241",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "07ff1c8a09e44b62e277fae50a1b1dc4"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "815ff7b82546c39864261dc332c8d6957fa1694f", filename = "activerecord/test/cases/base_test.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/0fd0d68962bfde407b6a35116efe277293e43962/activerecord/test/cases/base_test.rb",
raw_url = "https://github.com/rails/rails/raw/0fd0d68962bfde407b6a35116efe277293e43962/activerecord/test/cases/base_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/base_test.rb?ref=0fd0d68962bfde407b6a35116efe277293e43962",
patch = "@@ -895,7 +895,7 @@ def test_geometric_content\n assert g.save\n \n # Reload and check that we have all the geometric attributes.\n- h = Geometric.find(g.id)\n+ h = ActiveRecord::IdentityMap.without { Geometric.find(g.id) }\n \n assert_equal '(5,6.1)', h.a_point\n assert_equal '[(2,3),(5.5,7)]', h.a_line_segment\n@@ -923,7 +923,7 @@ def test_geometric_content\n assert g.save\n \n # Reload and check that we have all the geometric attributes.\n- h = Geometric.find(g.id)\n+ h = ActiveRecord::IdentityMap.without { Geometric.find(g.id) }\n \n assert_equal '(5,6.1)', h.a_point\n assert_equal '[(2,3),(5.5,7)]', h.a_line_segment"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:54 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 05:18:14 GMT",
etag = "\"e6dc8a573cf3b196bc9cde5caffd261e\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24863D:54D90242",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "b0ef53392caa42315c6206737946d931"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "a1376ae52a596bee5e286f984e922151f7a5fd5c", filename = "activesupport/lib/active_support/cache/file_store.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/099af2127e0ce387e7570b9c1feb83d9ac9ac87d/activesupport/lib/active_support/cache/file_store.rb",
raw_url = "https://github.com/rails/rails/raw/099af2127e0ce387e7570b9c1feb83d9ac9ac87d/activesupport/lib/active_support/cache/file_store.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/lib/active_support/cache/file_store.rb?ref=099af2127e0ce387e7570b9c1feb83d9ac9ac87d",
patch = "@@ -121,7 +121,7 @@ def delete_entry(key, options)\n # Lock a file for a block so only one process can modify it at a time.\n def lock_file(file_name, &block) # :nodoc:\n if File.exist?(file_name)\n- File.open(file_name, 'r') do |f|\n+ File.open(file_name, 'r+') do |f|\n begin\n f.flock File::LOCK_EX\n yield"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:54 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:59:45 GMT",
etag = "\"714b8c1f2442081620a9fd0cc48da521\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24865B:54D90242",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "76d9828c7e4f1d910f7ba069e90ce976"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "968d6ff4d0b8713d0f64c8ad27727ba29322cdb9", filename = "activesupport/activesupport.gemspec",
status = "modified", additions = 2L, deletions = 0L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/b24621809ebd4c69796b5ca6b41e7720bc52228a/activesupport/activesupport.gemspec",
raw_url = "https://github.com/rails/rails/raw/b24621809ebd4c69796b5ca6b41e7720bc52228a/activesupport/activesupport.gemspec",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/activesupport.gemspec?ref=b24621809ebd4c69796b5ca6b41e7720bc52228a",
patch = "@@ -16,4 +16,6 @@ Gem::Specification.new do |s|\n \n s.files = Dir['CHANGELOG', 'README.rdoc', 'lib/**/*']\n s.require_path = 'lib'\n+\n+ s.add_dependency('multi_json', '~> 1.0.0.rc3')\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "533ba25da34c8ea7508af73dea44282e86a4a4eb",
filename = "activesupport/lib/active_support/json/backends/jsongem.rb",
status = "removed", additions = 0L, deletions = 47L, changes = 47L,
blob_url = "https://github.com/rails/rails/blob/64e2a549cf92f25026a85575940a722492310125/activesupport/lib/active_support/json/backends/jsongem.rb",
raw_url = "https://github.com/rails/rails/raw/64e2a549cf92f25026a85575940a722492310125/activesupport/lib/active_support/json/backends/jsongem.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/lib/active_support/json/backends/jsongem.rb?ref=64e2a549cf92f25026a85575940a722492310125",
patch = "@@ -1,47 +0,0 @@\n-require 'json' unless defined?(JSON)\n-\n-module ActiveSupport\n- module JSON\n- module Backends\n- module JSONGem\n- ParseError = ::JSON::ParserError\n- extend self\n-\n- # Parses a JSON string or IO and convert it into an object\n- def decode(json)\n- if json.respond_to?(:read)\n- json = json.read\n- end\n- data = ::JSON.parse(json)\n- if ActiveSupport.parse_json_times\n- convert_dates_from(data)\n- else\n- data\n- end\n- end\n-\n- private\n- def convert_dates_from(data)\n- case data\n- when nil\n- nil\n- when DATE_REGEX\n- begin\n- DateTime.parse(data)\n- rescue ArgumentError\n- data\n- end\n- when Array\n- data.map! { |d| convert_dates_from(d) }\n- when Hash\n- data.each do |key, value|\n- data[key] = convert_dates_from(value)\n- end\n- else\n- data\n- end\n- end\n- end\n- end\n- end\n-end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "58818658c71f29c83b7a3ad9a8806c629bba5b18",
filename = "activesupport/lib/active_support/json/backends/yajl.rb",
status = "removed", additions = 0L, deletions = 44L, changes = 44L,
blob_url = "https://github.com/rails/rails/blob/64e2a549cf92f25026a85575940a722492310125/activesupport/lib/active_support/json/backends/yajl.rb",
raw_url = "https://github.com/rails/rails/raw/64e2a549cf92f25026a85575940a722492310125/activesupport/lib/active_support/json/backends/yajl.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/lib/active_support/json/backends/yajl.rb?ref=64e2a549cf92f25026a85575940a722492310125",
patch = "@@ -1,44 +0,0 @@\n-require 'yajl' unless defined?(Yajl)\n-\n-module ActiveSupport\n- module JSON\n- module Backends\n- module Yajl\n- ParseError = ::Yajl::ParseError\n- extend self\n-\n- # Parses a JSON string or IO and convert it into an object\n- def decode(json)\n- data = ::Yajl::Parser.new.parse(json)\n- if ActiveSupport.parse_json_times\n- convert_dates_from(data)\n- else\n- data\n- end\n- end\n-\n- private\n- def convert_dates_from(data)\n- case data\n- when nil\n- nil\n- when DATE_REGEX\n- begin\n- DateTime.parse(data)\n- rescue ArgumentError\n- data\n- end\n- when Array\n- data.map! { |d| convert_dates_from(d) }\n- when Hash\n- data.each do |key, value|\n- data[key] = convert_dates_from(value)\n- end\n- else\n- data\n- end\n- end\n- end\n- end\n- end\n-end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "e25e29d36be5d15b98c69a71363b8900f1613984",
filename = "activesupport/lib/active_support/json/backends/yaml.rb",
status = "removed", additions = 0L, deletions = 113L, changes = 113L,
blob_url = "https://github.com/rails/rails/blob/64e2a549cf92f25026a85575940a722492310125/activesupport/lib/active_support/json/backends/yaml.rb",
raw_url = "https://github.com/rails/rails/raw/64e2a549cf92f25026a85575940a722492310125/activesupport/lib/active_support/json/backends/yaml.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/lib/active_support/json/backends/yaml.rb?ref=64e2a549cf92f25026a85575940a722492310125",
patch = "@@ -1,113 +0,0 @@\n-require 'active_support/core_ext/string/starts_ends_with'\n-\n-module ActiveSupport\n- module JSON\n- module Backends\n- module Yaml\n- ParseError = ::StandardError\n- extend self\n-\n- EXCEPTIONS = [::ArgumentError] # :nodoc:\n- begin\n- require 'psych'\n- EXCEPTIONS << Psych::SyntaxError\n- rescue LoadError\n- end\n-\n- # Parses a JSON string or IO and converts it into an object\n- def decode(json)\n- if json.respond_to?(:read)\n- json = json.read\n- end\n- YAML.load(convert_json_to_yaml(json))\n- rescue *EXCEPTIONS => e\n- raise ParseError, \"Invalid JSON string: '%s'\" % json\n- end\n-\n- protected\n- # Ensure that \":\" and \",\" are always followed by a space\n- def convert_json_to_yaml(json) #:nodoc:\n- require 'strscan' unless defined? ::StringScanner\n- scanner, quoting, marks, pos, times = ::StringScanner.new(json), false, [], nil, []\n- while scanner.scan_until(/(\\\\['\"]|['\":,\\\\]|\\\\.|[\\]])/)\n- case char = scanner[1]\n- when '\"', \"'\"\n- if !quoting\n- quoting = char\n- pos = scanner.pos\n- elsif quoting == char\n- if valid_date?(json[pos..scanner.pos-2])\n- # found a date, track the exact positions of the quotes so we can\n- # overwrite them with spaces later.\n- times << pos\n- end\n- quoting = false\n- end\n- when \":\",\",\", \"]\"\n- marks << scanner.pos - 1 unless quoting\n- when \"\\\\\"\n- scanner.skip(/\\\\/)\n- end\n- end\n-\n- if marks.empty?\n- json.gsub(/\\\\([\\\\\\/]|u[[:xdigit:]]{4})/) do\n- ustr = $1\n- if ustr.start_with?('u')\n- char = [ustr[1..-1].to_i(16)].pack(\"U\")\n- # \"\\n\" needs extra escaping due to yaml formatting\n- char == \"\\n\" ? \"\\\\n\" : char\n- elsif ustr == '\\\\'\n- '\\\\\\\\'\n- else\n- ustr\n- end\n- end\n- else\n- left_pos = [-1].push(*marks)\n- right_pos = marks << scanner.pos + scanner.rest_size\n- output = []\n- left_pos.each_with_index do |left, i|\n- scanner.pos = left.succ\n- chunk = scanner.peek(right_pos[i] - scanner.pos + 1)\n- if ActiveSupport.parse_json_times\n- # overwrite the quotes found around the dates with spaces\n- while times.size > 0 && times[0] <= right_pos[i]\n- chunk.insert(times.shift - scanner.pos - 1, '! ')\n- end\n- end\n- chunk.gsub!(/\\\\([\\\\\\/]|u[[:xdigit:]]{4})/) do\n- ustr = $1\n- if ustr.start_with?('u')\n- char = [ustr[1..-1].to_i(16)].pack(\"U\")\n- # \"\\n\" needs extra escaping due to yaml formatting\n- char == \"\\n\" ? \"\\\\n\" : char\n- elsif ustr == '\\\\'\n- '\\\\\\\\'\n- else\n- ustr\n- end\n- end\n- output << chunk\n- end\n- output = output * \" \"\n-\n- output.gsub!(/\\\\\\//, '/')\n- output\n- end\n- end\n-\n- private\n- def valid_date?(date_string)\n- begin\n- date_string =~ DATE_REGEX && DateTime.parse(date_string)\n- rescue ArgumentError\n- false\n- end\n- end\n-\n- end\n- end\n- end\n-end\n-"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "cbeb6c0a281b54625b4b489b0accb165f8548ad9",
filename = "activesupport/lib/active_support/json/decoding.rb",
status = "modified", additions = 37L, deletions = 23L, changes = 60L,
blob_url = "https://github.com/rails/rails/blob/b24621809ebd4c69796b5ca6b41e7720bc52228a/activesupport/lib/active_support/json/decoding.rb",
raw_url = "https://github.com/rails/rails/raw/b24621809ebd4c69796b5ca6b41e7720bc52228a/activesupport/lib/active_support/json/decoding.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/lib/active_support/json/decoding.rb?ref=b24621809ebd4c69796b5ca6b41e7720bc52228a",
patch = "@@ -1,32 +1,31 @@\n require 'active_support/core_ext/module/attribute_accessors'\n require 'active_support/core_ext/module/delegation'\n+require 'multi_json'\n \n module ActiveSupport\n # Look for and parse json strings that look like ISO 8601 times.\n mattr_accessor :parse_json_times\n \n module JSON\n- # Listed in order of preference.\n- DECODERS = %w(Yajl Yaml)\n-\n class << self\n- attr_reader :parse_error\n- delegate :decode, :to => :backend\n+ def decode(json, options ={})\n+ data = MultiJson.decode(json, options)\n+ if ActiveSupport.parse_json_times\n+ convert_dates_from(data)\n+ else\n+ data\n+ end\n+ end\n \n- def backend\n- set_default_backend unless defined?(@backend)\n- @backend\n+ def engine\n+ MultiJson.engine\n end\n+ alias :backend :engine\n \n- def backend=(name)\n- if name.is_a?(Module)\n- @backend = name\n- else\n- require \"active_support/json/backends/#{name.to_s.downcase}\"\n- @backend = ActiveSupport::JSON::Backends::const_get(name)\n- end\n- @parse_error = @backend::ParseError\n+ def engine=(name)\n+ MultiJson.engine = name\n end\n+ alias :backend= :engine=\n \n def with_backend(name)\n old_backend, self.backend = backend, name\n@@ -35,15 +34,30 @@ def with_backend(name)\n self.backend = old_backend\n end\n \n- def set_default_backend\n- DECODERS.find do |name|\n+ def parse_error\n+ MultiJson::DecodeError\n+ end\n+\n+ private\n+\n+ def convert_dates_from(data)\n+ case data\n+ when nil\n+ nil\n+ when DATE_REGEX\n begin\n- self.backend = name\n- true\n- rescue LoadError\n- # Try next decoder.\n- false\n+ DateTime.parse(data)\n+ rescue ArgumentError\n+ data\n end\n+ when Array\n+ data.map! { |d| convert_dates_from(d) }\n+ when Hash\n+ data.each do |key, value|\n+ data[key] = convert_dates_from(value)\n+ end\n+ else\n+ data\n end\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "6ccffa59b1dacb0388b8997f7721829e486ab747",
filename = "activesupport/test/json/decoding_test.rb", status = "modified",
additions = 3L, deletions = 6L, changes = 9L, blob_url = "https://github.com/rails/rails/blob/b24621809ebd4c69796b5ca6b41e7720bc52228a/activesupport/test/json/decoding_test.rb",
raw_url = "https://github.com/rails/rails/raw/b24621809ebd4c69796b5ca6b41e7720bc52228a/activesupport/test/json/decoding_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/test/json/decoding_test.rb?ref=b24621809ebd4c69796b5ca6b41e7720bc52228a",
patch = "@@ -56,12 +56,9 @@ class TestJSONDecoding < ActiveSupport::TestCase\n %q({\"a\":\"Line1\\u000aLine2\"}) => {\"a\"=>\"Line1\\nLine2\"}\n }\n \n- # load the default JSON backend\n- ActiveSupport::JSON.backend = 'Yaml'\n-\n- backends = %w(Yaml)\n- backends << \"JSONGem\" if defined?(::JSON)\n- backends << \"Yajl\" if defined?(::Yajl)\n+ backends = [:ok_json]\n+ backends << :json_gem if defined?(::JSON)\n+ backends << :yajl if defined?(::Yajl)\n \n backends.each do |backend|\n TESTS.each do |json, expected|"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:54 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:36:00 GMT",
etag = "\"996017289b3fc7aafe058201f835e939\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24867F:54D90242",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "13d09b732ebe76f892093130dc088652"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "313aee4906a93226976fa2dcd9bb5baa64ba7acc", filename = "railties/lib/rails/generators/rails/app/templates/public/index.html",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/cd688b0914b271d50438a8fe6b869ab72e2a0b40/railties/lib/rails/generators/rails/app/templates/public/index.html",
raw_url = "https://github.com/rails/rails/raw/cd688b0914b271d50438a8fe6b869ab72e2a0b40/railties/lib/rails/generators/rails/app/templates/public/index.html",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/public/index.html?ref=cd688b0914b271d50438a8fe6b869ab72e2a0b40",
patch = "@@ -59,7 +59,7 @@\n \n \n #header {\n- background-image: url(\"/assets/rails.png\");\n+ background-image: url(\"/assets/images/rails.png\");\n background-repeat: no-repeat;\n background-position: top left;\n height: 64px;"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:54 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:59:45 GMT",
etag = "\"95ccecb1ab75633edb705811194f0a09\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248696:54D90242",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "8a5c38021a5cd7cef7b8f49a296fee40"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "45a7000cce731b79e91cb5042730b088c2a255e6", filename = "activerecord/lib/active_record/relation.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/1b9615eff0a792e2e6375d1482186414b3ca9ab1/activerecord/lib/active_record/relation.rb",
raw_url = "https://github.com/rails/rails/raw/1b9615eff0a792e2e6375d1482186414b3ca9ab1/activerecord/lib/active_record/relation.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/relation.rb?ref=1b9615eff0a792e2e6375d1482186414b3ca9ab1",
patch = "@@ -56,7 +56,7 @@ def insert(values)\n end\n \n substitutes.each_with_index do |tuple, i|\n- tuple[1] = conn.substitute_at(tuple.first, i)\n+ tuple[1] = conn.substitute_at(binds[i][0], i)\n end\n \n if values.empty? # empty insert"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:54 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 05:38:23 GMT",
etag = "\"db790b6fa7ce2df63e1e489119d80a00\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2486BC:54D90242",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "c6c65e5196703428e7641f7d1e9bc353"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "58febfd9c7e6a8066bbd12805cc12c1d5a1bcda0", filename = "railties/test/generators/app_generator_test.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/6bf3b2ac3061bbb980de35e3b623b5c4180ebed1/railties/test/generators/app_generator_test.rb",
raw_url = "https://github.com/rails/rails/raw/6bf3b2ac3061bbb980de35e3b623b5c4180ebed1/railties/test/generators/app_generator_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/generators/app_generator_test.rb?ref=6bf3b2ac3061bbb980de35e3b623b5c4180ebed1",
patch = "@@ -23,7 +23,7 @@\n lib\n lib/tasks\n log\n- public/images\n+ app/assets/images\n script/rails\n test/fixtures\n test/functional"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:54 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:59:45 GMT",
etag = "\"5f90244f9f1104bf6d15afac4f11d700\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2486D8:54D90242",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "01d096e6cfe28f8aea352e988c332cd3"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "563bff28be3b07b439f3c96386585c36aef230df", filename = "railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb",
status = "modified", additions = 10L, deletions = 0L, changes = 10L,
blob_url = "https://github.com/rails/rails/blob/92a50a9673a2e4f67c739c0fc800f6917c40b84a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb",
raw_url = "https://github.com/rails/rails/raw/92a50a9673a2e4f67c739c0fc800f6917c40b84a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb?ref=92a50a9673a2e4f67c739c0fc800f6917c40b84a",
patch = "@@ -135,6 +135,12 @@ def javascripts\n end\n end\n \n+ def images\n+ if mountable?\n+ empty_directory_with_gitkeep \"app/assets/images\"\n+ end\n+ end\n+\n def script(force = false)\n directory \"script\", :force => force do |content|\n \"#{shebang}\\n\" + content\n@@ -199,6 +205,10 @@ def create_javascript_files\n build(:javascripts)\n end\n \n+ def create_images_directory\n+ build(:images)\n+ end\n+\n def create_script_files\n build(:script)\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d12dc6925a9e9ca79ede83038042b53c90e9e499",
filename = "railties/test/generators/plugin_new_generator_test.rb",
status = "modified", additions = 4L, deletions = 0L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/92a50a9673a2e4f67c739c0fc800f6917c40b84a/railties/test/generators/plugin_new_generator_test.rb",
raw_url = "https://github.com/rails/rails/raw/92a50a9673a2e4f67c739c0fc800f6917c40b84a/railties/test/generators/plugin_new_generator_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/generators/plugin_new_generator_test.rb?ref=92a50a9673a2e4f67c739c0fc800f6917c40b84a",
patch = "@@ -147,6 +147,7 @@ def test_creating_engine_in_full_mode\n run_generator [destination_root, \"--full\"]\n assert_file \"app/assets/javascripts\"\n assert_file \"app/assets/stylesheets\"\n+ assert_file \"app/assets/images\"\n assert_file \"app/models\"\n assert_file \"app/controllers\"\n assert_file \"app/views\"\n@@ -162,6 +163,9 @@ def test_being_quiet_while_creating_dummy_application\n \n def test_create_mountable_application_with_mountable_option\n run_generator [destination_root, \"--mountable\"]\n+ assert_file \"app/assets/javascripts\"\n+ assert_file \"app/assets/stylesheets\"\n+ assert_file \"app/assets/images\"\n assert_file \"config/routes.rb\", /Bukkits::Engine.routes.draw do/\n assert_file \"lib/bukkits/engine.rb\", /isolate_namespace Bukkits/\n assert_file \"test/dummy/config/routes.rb\", /mount Bukkits::Engine => \"\\/bukkits\"/"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:54 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:48:06 GMT",
etag = "\"50bddce00002db2519068f80213be3a0\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2486F2:54D90242",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "8a5c38021a5cd7cef7b8f49a296fee40"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "98272c7261ed802d50bb860d3278bd2b583073b0", filename = "Gemfile",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/348b5b99380b245d45dd4a877546d1a90a85a94b/Gemfile",
raw_url = "https://github.com/rails/rails/raw/348b5b99380b245d45dd4a877546d1a90a85a94b/Gemfile",
contents_url = "https://api.github.com/repos/rails/rails/contents/Gemfile?ref=348b5b99380b245d45dd4a877546d1a90a85a94b",
patch = "@@ -13,7 +13,7 @@ gem \"rack-test\", :git => \"git://github.com/brynary/rack-test.git\"\n \n gem \"sprockets\", :git => \"git://github.com/sstephenson/sprockets.git\"\n gem \"coffee-script\"\n-gem \"sass\", \">= 3.0\"\n+gem \"sass\"\n gem \"uglifier\"\n \n gem \"rake\", \">= 0.8.7\""), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:54 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:59:45 GMT",
etag = "\"8497dd7499a3138e32b60dfe3ba3843f\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24870A:54D90242",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "318e55760cf7cdb40e61175a4d36cd32"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "4e6d9ae0878168ee965c45471686ed4736d2f4cd", filename = "activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb",
status = "modified", additions = 10L, deletions = 1L, changes = 11L,
blob_url = "https://github.com/rails/rails/blob/714b4a82f43e3882516e81e8fac8da34e72b190e/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb",
raw_url = "https://github.com/rails/rails/raw/714b4a82f43e3882516e81e8fac8da34e72b190e/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb?ref=714b4a82f43e3882516e81e8fac8da34e72b190e",
patch = "@@ -95,6 +95,9 @@ def simplified_type(field_type)\n # XML type\n when 'xml'\n :xml\n+ # tsvector type\n+ when 'tsvector'\n+ :tsvector\n # Arrays\n when /^\\D+\\[\\]$/\n :string\n@@ -186,6 +189,11 @@ def xml(*args)\n options = args.extract_options!\n column(args[0], 'xml', options)\n end\n+\n+ def tsvector(*args)\n+ options = args.extract_options!\n+ column(args[0], 'tsvector', options)\n+ end\n end\n \n ADAPTER_NAME = 'PostgreSQL'\n@@ -203,7 +211,8 @@ def xml(*args)\n :date => { :name => \"date\" },\n :binary => { :name => \"bytea\" },\n :boolean => { :name => \"boolean\" },\n- :xml => { :name => \"xml\" }\n+ :xml => { :name => \"xml\" },\n+ :tsvector => { :name => \"tsvector\" }\n }\n \n # Returns 'PostgreSQL' as adapter name for identification purposes."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ce08e4c6a76336264a37b16105f8c949eaef47fe",
filename = "activerecord/test/cases/adapters/postgresql/datatype_test.rb",
status = "modified", additions = 25L, deletions = 0L, changes = 25L,
blob_url = "https://github.com/rails/rails/blob/714b4a82f43e3882516e81e8fac8da34e72b190e/activerecord/test/cases/adapters/postgresql/datatype_test.rb",
raw_url = "https://github.com/rails/rails/raw/714b4a82f43e3882516e81e8fac8da34e72b190e/activerecord/test/cases/adapters/postgresql/datatype_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/adapters/postgresql/datatype_test.rb?ref=714b4a82f43e3882516e81e8fac8da34e72b190e",
patch = "@@ -3,6 +3,9 @@\n class PostgresqlArray < ActiveRecord::Base\n end\n \n+class PostgresqlTsvector < ActiveRecord::Base\n+end\n+\n class PostgresqlMoney < ActiveRecord::Base\n end\n \n@@ -34,6 +37,9 @@ def setup\n @connection.execute(\"INSERT INTO postgresql_arrays (commission_by_quarter, nicknames) VALUES ( '{35000,21000,18000,17000}', '{foo,bar,baz}' )\")\n @first_array = PostgresqlArray.find(1)\n \n+ @connection.execute(\"INSERT INTO postgresql_tsvectors (text_vector) VALUES (' ''text'' ''vector'' ')\")\n+ @first_tsvector = PostgresqlTsvector.find(1)\n+\n @connection.execute(\"INSERT INTO postgresql_moneys (wealth) VALUES ('567.89'::money)\")\n @connection.execute(\"INSERT INTO postgresql_moneys (wealth) VALUES ('-567.89'::money)\")\n @first_money = PostgresqlMoney.find(1)\n@@ -62,6 +68,10 @@ def test_data_type_of_array_types\n assert_equal :string, @first_array.column_for_attribute(:nicknames).type\n end\n \n+ def test_data_type_of_tsvector_types\n+ assert_equal :tsvector, @first_tsvector.column_for_attribute(:text_vector).type\n+ end\n+\n def test_data_type_of_money_types\n assert_equal :decimal, @first_money.column_for_attribute(:wealth).type\n end\n@@ -95,11 +105,26 @@ def test_array_values\n assert_equal '{foo,bar,baz}', @first_array.nicknames\n end\n \n+ def test_tsvector_values\n+ assert_equal \"'text' 'vector'\", @first_tsvector.text_vector\n+ end\n+\n def test_money_values\n assert_equal 567.89, @first_money.wealth\n assert_equal(-567.89, @second_money.wealth)\n end\n \n+ def test_update_tsvector\n+ new_text_vector = \"'new' 'text' 'vector'\"\n+ assert @first_tsvector.text_vector = new_text_vector\n+ assert @first_tsvector.save\n+ assert @first_tsvector.reload\n+ assert @first_tsvector.text_vector = new_text_vector\n+ assert @first_tsvector.save\n+ assert @first_tsvector.reload\n+ assert_equal @first_tsvector.text_vector, new_text_vector\n+ end\n+\n def test_number_values\n assert_equal 123.456, @first_number.single\n assert_equal 123456.789, @first_number.double"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "e8f2f4418952b1fc65f2f8bd92019526ec43c24c",
filename = "activerecord/test/cases/schema_dumper_test.rb",
status = "modified", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/714b4a82f43e3882516e81e8fac8da34e72b190e/activerecord/test/cases/schema_dumper_test.rb",
raw_url = "https://github.com/rails/rails/raw/714b4a82f43e3882516e81e8fac8da34e72b190e/activerecord/test/cases/schema_dumper_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/schema_dumper_test.rb?ref=714b4a82f43e3882516e81e8fac8da34e72b190e",
patch = "@@ -203,6 +203,13 @@ def test_schema_dump_includes_xml_shorthand_definition\n assert_match %r{t.xml \"data\"}, output\n end\n end\n+\n+ def test_schema_dump_includes_tsvector_shorthand_definition\n+ output = standard_dump\n+ if %r{create_table \"postgresql_tsvectors\"} =~ output\n+ assert_match %r{t.tsvector \"text_vector\"}, output\n+ end\n+ end\n end\n \n def test_schema_dump_keeps_large_precision_integer_columns_as_decimal"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "5cf9a207f3310080d496b46612c9097d2172f7c8",
filename = "activerecord/test/schema/postgresql_specific_schema.rb",
status = "modified", additions = 9L, deletions = 1L, changes = 10L,
blob_url = "https://github.com/rails/rails/blob/714b4a82f43e3882516e81e8fac8da34e72b190e/activerecord/test/schema/postgresql_specific_schema.rb",
raw_url = "https://github.com/rails/rails/raw/714b4a82f43e3882516e81e8fac8da34e72b190e/activerecord/test/schema/postgresql_specific_schema.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/schema/postgresql_specific_schema.rb?ref=714b4a82f43e3882516e81e8fac8da34e72b190e",
patch = "@@ -1,6 +1,6 @@\n ActiveRecord::Schema.define do\n \n- %w(postgresql_arrays postgresql_moneys postgresql_numbers postgresql_times postgresql_network_addresses postgresql_bit_strings\n+ %w(postgresql_tsvectors postgresql_arrays postgresql_moneys postgresql_numbers postgresql_times postgresql_network_addresses postgresql_bit_strings\n postgresql_oids postgresql_xml_data_type defaults geometrics postgresql_timestamp_with_zones).each do |table_name|\n execute \"DROP TABLE IF EXISTS #{quote_table_name table_name}\"\n end\n@@ -55,6 +55,14 @@\n nicknames TEXT[]\n );\n _SQL\n+\n+ execute <<_SQL\n+ CREATE TABLE postgresql_tsvectors (\n+ id SERIAL PRIMARY KEY,\n+ text_vector tsvector\n+ );\n+_SQL\n+\n execute <<_SQL\n CREATE TABLE postgresql_moneys (\n id SERIAL PRIMARY KEY,"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:54 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 15:54:44 GMT",
etag = "\"ecd37892bfb54c1334d4bd5af618a467\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24872A:54D90242",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "76d9828c7e4f1d910f7ba069e90ce976"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "998d237ada06f6ab546ad394ade4b72714ee48a1", filename = "activerecord/lib/active_record/persistence.rb",
status = "modified", additions = 9L, deletions = 4L, changes = 13L,
blob_url = "https://github.com/rails/rails/blob/bb7024b6ecbc6f379275de3a7171bd0e84d39f29/activerecord/lib/active_record/persistence.rb",
raw_url = "https://github.com/rails/rails/raw/bb7024b6ecbc6f379275de3a7171bd0e84d39f29/activerecord/lib/active_record/persistence.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/persistence.rb?ref=bb7024b6ecbc6f379275de3a7171bd0e84d39f29",
patch = "@@ -136,22 +136,27 @@ def update_column(name, value)\n # Updates the attributes of the model from the passed-in hash and saves the\n # record, all wrapped in a transaction. If the object is invalid, the saving\n # will fail and false will be returned.\n- def update_attributes(attributes)\n+ #\n+ # When updating model attributes, mass-assignment security protection is respected.\n+ # If no +:as+ option is supplied then the :default scope will be used.\n+ # If you want to bypass the protection given by +attr_protected+ and\n+ # +attr_accessible+ then you can do so using the +:without_protection+ option.\n+ def update_attributes(attributes, options = {})\n # The following transaction covers any possible database side-effects of the\n # attributes assignment. For example, setting the IDs of a child collection.\n with_transaction_returning_status do\n- self.attributes = attributes\n+ self.assign_attributes(attributes, options)\n save\n end\n end\n \n # Updates its receiver just like +update_attributes+ but calls <tt>save!</tt> instead\n # of +save+, so an exception is raised if the record is invalid.\n- def update_attributes!(attributes)\n+ def update_attributes!(attributes, options = {})\n # The following transaction covers any possible database side-effects of the\n # attributes assignment. For example, setting the IDs of a child collection.\n with_transaction_returning_status do\n- self.attributes = attributes\n+ self.assign_attributes(attributes, options)\n save!\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "2044bc6e3f99b58047d8451021f9e4e4ea638b48",
filename = "activerecord/test/cases/persistence_test.rb",
status = "modified", additions = 40L, deletions = 0L, changes = 40L,
blob_url = "https://github.com/rails/rails/blob/bb7024b6ecbc6f379275de3a7171bd0e84d39f29/activerecord/test/cases/persistence_test.rb",
raw_url = "https://github.com/rails/rails/raw/bb7024b6ecbc6f379275de3a7171bd0e84d39f29/activerecord/test/cases/persistence_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/persistence_test.rb?ref=bb7024b6ecbc6f379275de3a7171bd0e84d39f29",
patch = "@@ -491,6 +491,26 @@ def test_update_attributes\n assert_equal \"The First Topic\", topic.title\n end\n \n+ def test_update_attributes_as_admin\n+ person = TightPerson.create\n+ person.update_attributes({ \"first_name\" => 'Josh', \"gender\" => 'male', \"comments\" => 'from NZ' }, :as => :admin)\n+ person.reload\n+\n+ assert_equal 'Josh', person.first_name\n+ assert_equal 'male', person.gender\n+ assert_equal 'from NZ', person.comments\n+ end\n+\n+ def test_update_attributes_as_without_protection\n+ person = TightPerson.create\n+ person.update_attributes({ \"first_name\" => 'Josh', \"gender\" => 'male', \"comments\" => 'from NZ' }, :without_protection => true)\n+ person.reload\n+\n+ assert_equal 'Josh', person.first_name\n+ assert_equal 'male', person.gender\n+ assert_equal 'from NZ', person.comments\n+ end\n+\n def test_update_attributes!\n Reply.validates_presence_of(:title)\n reply = Reply.find(2)\n@@ -512,6 +532,26 @@ def test_update_attributes!\n Reply.reset_callbacks(:validate)\n end\n \n+ def test_update_attributes_as_admin\n+ person = TightPerson.create\n+ person.update_attributes!({ \"first_name\" => 'Josh', \"gender\" => 'male', \"comments\" => 'from NZ' }, :as => :admin)\n+ person.reload\n+\n+ assert_equal 'Josh', person.first_name\n+ assert_equal 'male', person.gender\n+ assert_equal 'from NZ', person.comments\n+ end\n+\n+ def test_update_attributes_as_without_protection\n+ person = TightPerson.create\n+ person.update_attributes!({ \"first_name\" => 'Josh', \"gender\" => 'male', \"comments\" => 'from NZ' }, :without_protection => true)\n+ person.reload\n+\n+ assert_equal 'Josh', person.first_name\n+ assert_equal 'male', person.gender\n+ assert_equal 'from NZ', person.comments\n+ end\n+\n def test_destroyed_returns_boolean\n developer = Developer.first\n assert_equal false, developer.destroyed?"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:55 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:36:00 GMT",
etag = "\"92160e20902890819ed7efe8a2ad1006\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24874B:54D90242",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "318e55760cf7cdb40e61175a4d36cd32"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "cb6737b94e60d7e3c0ca61d9291e55081cda7dd2", filename = "actionpack/lib/action_view/helpers/asset_paths.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/c15108ce063f6396a6e93a54e973b858d0280d41/actionpack/lib/action_view/helpers/asset_paths.rb",
raw_url = "https://github.com/rails/rails/raw/c15108ce063f6396a6e93a54e973b858d0280d41/actionpack/lib/action_view/helpers/asset_paths.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_view/helpers/asset_paths.rb?ref=c15108ce063f6396a6e93a54e973b858d0280d41",
patch = "@@ -12,7 +12,7 @@ def initialize(config, controller)\n @controller = controller\n end\n \n- # Add the extension +ext+ if not present. Return full URLs otherwise untouched.\n+ # Add the extension +ext+ if not present. Return full or scheme-relative URLs otherwise untouched.\n # Prefix with <tt>/dir/</tt> if lacking a leading +/+. Account for relative URL\n # roots. Rewrite the asset path for cache-busting asset ids. Include\n # asset host, if configured, with the correct request protocol.\n@@ -33,7 +33,7 @@ def compute_public_path(source, dir, ext = nil, include_host = true)\n end\n \n def is_uri?(path)\n- path =~ %r{^[-a-z]+://|^cid:}\n+ path =~ %r{^[-a-z]+://|^cid:|^//}\n end\n \n private"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "2abc806e974e7c959709e6d967c70da0fe4e6caf",
filename = "actionpack/test/template/asset_tag_helper_test.rb",
status = "modified", additions = 15L, deletions = 0L, changes = 15L,
blob_url = "https://github.com/rails/rails/blob/c15108ce063f6396a6e93a54e973b858d0280d41/actionpack/test/template/asset_tag_helper_test.rb",
raw_url = "https://github.com/rails/rails/raw/c15108ce063f6396a6e93a54e973b858d0280d41/actionpack/test/template/asset_tag_helper_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/template/asset_tag_helper_test.rb?ref=c15108ce063f6396a6e93a54e973b858d0280d41",
patch = "@@ -66,6 +66,7 @@ def teardown\n %(auto_discovery_link_tag(:xml)) => %(<link href=\"http://www.example.com\" rel=\"alternate\" title=\"XML\" type=\"application/xml\" />),\n %(auto_discovery_link_tag(:rss, :action => \"feed\")) => %(<link href=\"http://www.example.com\" rel=\"alternate\" title=\"RSS\" type=\"application/rss+xml\" />),\n %(auto_discovery_link_tag(:rss, \"http://localhost/feed\")) => %(<link href=\"http://localhost/feed\" rel=\"alternate\" title=\"RSS\" type=\"application/rss+xml\" />),\n+ %(auto_discovery_link_tag(:rss, \"//localhost/feed\")) => %(<link href=\"//localhost/feed\" rel=\"alternate\" title=\"RSS\" type=\"application/rss+xml\" />),\n %(auto_discovery_link_tag(:rss, {:action => \"feed\"}, {:title => \"My RSS\"})) => %(<link href=\"http://www.example.com\" rel=\"alternate\" title=\"My RSS\" type=\"application/rss+xml\" />),\n %(auto_discovery_link_tag(:rss, {}, {:title => \"My RSS\"})) => %(<link href=\"http://www.example.com\" rel=\"alternate\" title=\"My RSS\" type=\"application/rss+xml\" />),\n %(auto_discovery_link_tag(nil, {}, {:type => \"text/html\"})) => %(<link href=\"http://www.example.com\" rel=\"alternate\" title=\"\" type=\"text/html\" />),\n@@ -100,6 +101,7 @@ def teardown\n \n %(javascript_include_tag(\"http://example.com/all\")) => %(<script src=\"http://example.com/all\" type=\"text/javascript\"></script>),\n %(javascript_include_tag(\"http://example.com/all.js\")) => %(<script src=\"http://example.com/all.js\" type=\"text/javascript\"></script>),\n+ %(javascript_include_tag(\"//example.com/all.js\")) => %(<script src=\"//example.com/all.js\" type=\"text/javascript\"></script>),\n }\n \n StylePathToTag = {\n@@ -129,6 +131,7 @@ def teardown\n \n %(stylesheet_link_tag(\"http://www.example.com/styles/style\")) => %(<link href=\"http://www.example.com/styles/style\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />),\n %(stylesheet_link_tag(\"http://www.example.com/styles/style.css\")) => %(<link href=\"http://www.example.com/styles/style.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />),\n+ %(stylesheet_link_tag(\"//www.example.com/styles/style.css\")) => %(<link href=\"//www.example.com/styles/style.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />),\n }\n \n ImagePathToTag = {\n@@ -157,6 +160,7 @@ def teardown\n %(image_tag(\"slash..png\")) => %(<img alt=\"Slash.\" src=\"/images/slash..png\" />),\n %(image_tag(\".pdf.png\")) => %(<img alt=\".pdf\" src=\"/images/.pdf.png\" />),\n %(image_tag(\"http://www.rubyonrails.com/images/rails.png\")) => %(<img alt=\"Rails\" src=\"http://www.rubyonrails.com/images/rails.png\" />),\n+ %(image_tag(\"//www.rubyonrails.com/images/rails.png\")) => %(<img alt=\"Rails\" src=\"//www.rubyonrails.com/images/rails.png\" />),\n %(image_tag(\"mouse.png\", :mouseover => \"/images/mouse_over.png\")) => %(<img alt=\"Mouse\" onmouseover=\"this.src='/images/mouse_over.png'\" onmouseout=\"this.src='/images/mouse.png'\" src=\"/images/mouse.png\" />),\n %(image_tag(\"mouse.png\", :mouseover => image_path(\"mouse_over.png\"))) => %(<img alt=\"Mouse\" onmouseover=\"this.src='/images/mouse_over.png'\" onmouseout=\"this.src='/images/mouse.png'\" src=\"/images/mouse.png\" />),\n %(image_tag(\"mouse.png\", :alt => nil)) => %(<img src=\"/images/mouse.png\" />)\n@@ -195,6 +199,7 @@ def teardown\n %(video_tag(\"error.avi\", \"size\" => \"100 x 100\")) => %(<video src=\"/videos/error.avi\" />),\n %(video_tag(\"error.avi\", \"size\" => \"x\")) => %(<video src=\"/videos/error.avi\" />),\n %(video_tag(\"http://media.rubyonrails.org/video/rails_blog_2.mov\")) => %(<video src=\"http://media.rubyonrails.org/video/rails_blog_2.mov\" />),\n+ %(video_tag(\"//media.rubyonrails.org/video/rails_blog_2.mov\")) => %(<video src=\"//media.rubyonrails.org/video/rails_blog_2.mov\" />),\n %(video_tag([\"multiple.ogg\", \"multiple.avi\"])) => %(<video><source src=\"multiple.ogg\" /><source src=\"multiple.avi\" /></video>),\n %(video_tag([\"multiple.ogg\", \"multiple.avi\"], :size => \"160x120\", :controls => true)) => %(<video controls=\"controls\" height=\"120\" width=\"160\"><source src=\"multiple.ogg\" /><source src=\"multiple.avi\" /></video>)\n }\n@@ -217,6 +222,7 @@ def teardown\n %(audio_tag(\"xml.wav\")) => %(<audio src=\"/audios/xml.wav\" />),\n %(audio_tag(\"rss.wav\", :autoplay => true, :controls => true)) => %(<audio autoplay=\"autoplay\" controls=\"controls\" src=\"/audios/rss.wav\" />),\n %(audio_tag(\"http://media.rubyonrails.org/audio/rails_blog_2.mov\")) => %(<audio src=\"http://media.rubyonrails.org/audio/rails_blog_2.mov\" />),\n+ %(audio_tag(\"//media.rubyonrails.org/audio/rails_blog_2.mov\")) => %(<audio src=\"//media.rubyonrails.org/audio/rails_blog_2.mov\" />),\n }\n \n def test_auto_discovery_link_tag\n@@ -505,6 +511,10 @@ def test_should_skip_asset_id_on_complete_url\n assert_equal %(<img alt=\"Rails\" src=\"http://www.example.com/rails.png\" />), image_tag(\"http://www.example.com/rails.png\")\n end\n \n+ def test_should_skip_asset_id_on_scheme_relative_url\n+ assert_equal %(<img alt=\"Rails\" src=\"//www.example.com/rails.png\" />), image_tag(\"//www.example.com/rails.png\")\n+ end\n+\n def test_should_use_preset_asset_id\n ENV[\"RAILS_ASSET_ID\"] = \"4500\"\n assert_equal %(<img alt=\"Rails\" src=\"/images/rails.png?4500\" />), image_tag(\"rails.png\")\n@@ -1095,6 +1105,11 @@ def test_should_ignore_asset_host_on_complete_url\n assert_dom_equal(%(<link href=\"http://bar.example.com/stylesheets/style.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />), stylesheet_link_tag(\"http://bar.example.com/stylesheets/style.css\"))\n end\n \n+ def test_should_ignore_asset_host_on_scheme_relative_url\n+ @controller.config.asset_host = \"http://assets.example.com\"\n+ assert_dom_equal(%(<link href=\"//bar.example.com/stylesheets/style.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />), stylesheet_link_tag(\"//bar.example.com/stylesheets/style.css\"))\n+ end\n+\n def test_should_wildcard_asset_host_between_zero_and_four\n @controller.config.asset_host = 'http://a%d.example.com'\n assert_match(%r(http://a[0123].example.com/collaboration/hieraki/images/xml.png), image_path('xml.png'))"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:55 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Wed, 28 Jan 2015 20:22:37 GMT",
etag = "\"407d9664fd56966dc74849f348372722\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24876A:54D90243",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "13d09b732ebe76f892093130dc088652"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "8b6ddbd7c98d7d554abe655ac65f0b626a32c30b", filename = "Gemfile",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/Gemfile",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/Gemfile",
contents_url = "https://api.github.com/repos/rails/rails/contents/Gemfile?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -54,7 +54,7 @@ platforms :ruby do\n group :db do\n gem \"pg\", \">= 0.11.0\"\n gem \"mysql\", \">= 2.8.1\"\n- gem \"mysql2\", :git => \"git://github.com/brianmario/mysql2.git\"\n+ gem \"mysql2\", \">= 0.3.0\"\n end\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "0085f542aabafa1b273f9c20a141545959d35b74",
filename = "actionpack/lib/action_controller/test_case.rb",
status = "modified", additions = 3L, deletions = 1L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/actionpack/lib/action_controller/test_case.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/actionpack/lib/action_controller/test_case.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_controller/test_case.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -147,7 +147,9 @@ def assign_parameters(routes, controller_path, action, parameters = {})\n if value.is_a? Fixnum\n value = value.to_s\n elsif value.is_a? Array\n- value = Result.new(value)\n+ value = Result.new(value.map { |v| v.is_a?(String) ? v.dup : v })\n+ elsif value.is_a? String\n+ value = value.dup\n end\n \n if extra_keys.include?(key.to_sym)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "cb6737b94e60d7e3c0ca61d9291e55081cda7dd2",
filename = "actionpack/lib/action_view/helpers/asset_paths.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/actionpack/lib/action_view/helpers/asset_paths.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/actionpack/lib/action_view/helpers/asset_paths.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_view/helpers/asset_paths.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -12,7 +12,7 @@ def initialize(config, controller)\n @controller = controller\n end\n \n- # Add the extension +ext+ if not present. Return full URLs otherwise untouched.\n+ # Add the extension +ext+ if not present. Return full or scheme-relative URLs otherwise untouched.\n # Prefix with <tt>/dir/</tt> if lacking a leading +/+. Account for relative URL\n # roots. Rewrite the asset path for cache-busting asset ids. Include\n # asset host, if configured, with the correct request protocol.\n@@ -33,7 +33,7 @@ def compute_public_path(source, dir, ext = nil, include_host = true)\n end\n \n def is_uri?(path)\n- path =~ %r{^[-a-z]+://|^cid:}\n+ path =~ %r{^[-a-z]+://|^cid:|^//}\n end\n \n private"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "5896222a0a9709428051ce09be10f72cca769337",
filename = "actionpack/test/controller/test_test.rb", status = "modified",
additions = 12L, deletions = 0L, changes = 12L, blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/actionpack/test/controller/test_test.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/actionpack/test/controller/test_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/controller/test_test.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -493,6 +493,18 @@ def test_params_passing\n )\n end\n \n+ def test_params_passing_with_frozen_values\n+ assert_nothing_raised do\n+ get :test_params, :frozen => 'icy'.freeze, :frozens => ['icy'.freeze].freeze\n+ end\n+ parsed_params = eval(@response.body)\n+ assert_equal(\n+ {'controller' => 'test_test/test', 'action' => 'test_params',\n+ 'frozen' => 'icy', 'frozens' => ['icy']},\n+ parsed_params\n+ )\n+ end\n+\n def test_id_converted_to_string\n get :test_params, :id => 20, :foo => Object.new\n assert_kind_of String, @request.path_parameters['id']"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "2abc806e974e7c959709e6d967c70da0fe4e6caf",
filename = "actionpack/test/template/asset_tag_helper_test.rb",
status = "modified", additions = 15L, deletions = 0L, changes = 15L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/actionpack/test/template/asset_tag_helper_test.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/actionpack/test/template/asset_tag_helper_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/template/asset_tag_helper_test.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -66,6 +66,7 @@ def teardown\n %(auto_discovery_link_tag(:xml)) => %(<link href=\"http://www.example.com\" rel=\"alternate\" title=\"XML\" type=\"application/xml\" />),\n %(auto_discovery_link_tag(:rss, :action => \"feed\")) => %(<link href=\"http://www.example.com\" rel=\"alternate\" title=\"RSS\" type=\"application/rss+xml\" />),\n %(auto_discovery_link_tag(:rss, \"http://localhost/feed\")) => %(<link href=\"http://localhost/feed\" rel=\"alternate\" title=\"RSS\" type=\"application/rss+xml\" />),\n+ %(auto_discovery_link_tag(:rss, \"//localhost/feed\")) => %(<link href=\"//localhost/feed\" rel=\"alternate\" title=\"RSS\" type=\"application/rss+xml\" />),\n %(auto_discovery_link_tag(:rss, {:action => \"feed\"}, {:title => \"My RSS\"})) => %(<link href=\"http://www.example.com\" rel=\"alternate\" title=\"My RSS\" type=\"application/rss+xml\" />),\n %(auto_discovery_link_tag(:rss, {}, {:title => \"My RSS\"})) => %(<link href=\"http://www.example.com\" rel=\"alternate\" title=\"My RSS\" type=\"application/rss+xml\" />),\n %(auto_discovery_link_tag(nil, {}, {:type => \"text/html\"})) => %(<link href=\"http://www.example.com\" rel=\"alternate\" title=\"\" type=\"text/html\" />),\n@@ -100,6 +101,7 @@ def teardown\n \n %(javascript_include_tag(\"http://example.com/all\")) => %(<script src=\"http://example.com/all\" type=\"text/javascript\"></script>),\n %(javascript_include_tag(\"http://example.com/all.js\")) => %(<script src=\"http://example.com/all.js\" type=\"text/javascript\"></script>),\n+ %(javascript_include_tag(\"//example.com/all.js\")) => %(<script src=\"//example.com/all.js\" type=\"text/javascript\"></script>),\n }\n \n StylePathToTag = {\n@@ -129,6 +131,7 @@ def teardown\n \n %(stylesheet_link_tag(\"http://www.example.com/styles/style\")) => %(<link href=\"http://www.example.com/styles/style\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />),\n %(stylesheet_link_tag(\"http://www.example.com/styles/style.css\")) => %(<link href=\"http://www.example.com/styles/style.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />),\n+ %(stylesheet_link_tag(\"//www.example.com/styles/style.css\")) => %(<link href=\"//www.example.com/styles/style.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />),\n }\n \n ImagePathToTag = {\n@@ -157,6 +160,7 @@ def teardown\n %(image_tag(\"slash..png\")) => %(<img alt=\"Slash.\" src=\"/images/slash..png\" />),\n %(image_tag(\".pdf.png\")) => %(<img alt=\".pdf\" src=\"/images/.pdf.png\" />),\n %(image_tag(\"http://www.rubyonrails.com/images/rails.png\")) => %(<img alt=\"Rails\" src=\"http://www.rubyonrails.com/images/rails.png\" />),\n+ %(image_tag(\"//www.rubyonrails.com/images/rails.png\")) => %(<img alt=\"Rails\" src=\"//www.rubyonrails.com/images/rails.png\" />),\n %(image_tag(\"mouse.png\", :mouseover => \"/images/mouse_over.png\")) => %(<img alt=\"Mouse\" onmouseover=\"this.src='/images/mouse_over.png'\" onmouseout=\"this.src='/images/mouse.png'\" src=\"/images/mouse.png\" />),\n %(image_tag(\"mouse.png\", :mouseover => image_path(\"mouse_over.png\"))) => %(<img alt=\"Mouse\" onmouseover=\"this.src='/images/mouse_over.png'\" onmouseout=\"this.src='/images/mouse.png'\" src=\"/images/mouse.png\" />),\n %(image_tag(\"mouse.png\", :alt => nil)) => %(<img src=\"/images/mouse.png\" />)\n@@ -195,6 +199,7 @@ def teardown\n %(video_tag(\"error.avi\", \"size\" => \"100 x 100\")) => %(<video src=\"/videos/error.avi\" />),\n %(video_tag(\"error.avi\", \"size\" => \"x\")) => %(<video src=\"/videos/error.avi\" />),\n %(video_tag(\"http://media.rubyonrails.org/video/rails_blog_2.mov\")) => %(<video src=\"http://media.rubyonrails.org/video/rails_blog_2.mov\" />),\n+ %(video_tag(\"//media.rubyonrails.org/video/rails_blog_2.mov\")) => %(<video src=\"//media.rubyonrails.org/video/rails_blog_2.mov\" />),\n %(video_tag([\"multiple.ogg\", \"multiple.avi\"])) => %(<video><source src=\"multiple.ogg\" /><source src=\"multiple.avi\" /></video>),\n %(video_tag([\"multiple.ogg\", \"multiple.avi\"], :size => \"160x120\", :controls => true)) => %(<video controls=\"controls\" height=\"120\" width=\"160\"><source src=\"multiple.ogg\" /><source src=\"multiple.avi\" /></video>)\n }\n@@ -217,6 +222,7 @@ def teardown\n %(audio_tag(\"xml.wav\")) => %(<audio src=\"/audios/xml.wav\" />),\n %(audio_tag(\"rss.wav\", :autoplay => true, :controls => true)) => %(<audio autoplay=\"autoplay\" controls=\"controls\" src=\"/audios/rss.wav\" />),\n %(audio_tag(\"http://media.rubyonrails.org/audio/rails_blog_2.mov\")) => %(<audio src=\"http://media.rubyonrails.org/audio/rails_blog_2.mov\" />),\n+ %(audio_tag(\"//media.rubyonrails.org/audio/rails_blog_2.mov\")) => %(<audio src=\"//media.rubyonrails.org/audio/rails_blog_2.mov\" />),\n }\n \n def test_auto_discovery_link_tag\n@@ -505,6 +511,10 @@ def test_should_skip_asset_id_on_complete_url\n assert_equal %(<img alt=\"Rails\" src=\"http://www.example.com/rails.png\" />), image_tag(\"http://www.example.com/rails.png\")\n end\n \n+ def test_should_skip_asset_id_on_scheme_relative_url\n+ assert_equal %(<img alt=\"Rails\" src=\"//www.example.com/rails.png\" />), image_tag(\"//www.example.com/rails.png\")\n+ end\n+\n def test_should_use_preset_asset_id\n ENV[\"RAILS_ASSET_ID\"] = \"4500\"\n assert_equal %(<img alt=\"Rails\" src=\"/images/rails.png?4500\" />), image_tag(\"rails.png\")\n@@ -1095,6 +1105,11 @@ def test_should_ignore_asset_host_on_complete_url\n assert_dom_equal(%(<link href=\"http://bar.example.com/stylesheets/style.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />), stylesheet_link_tag(\"http://bar.example.com/stylesheets/style.css\"))\n end\n \n+ def test_should_ignore_asset_host_on_scheme_relative_url\n+ @controller.config.asset_host = \"http://assets.example.com\"\n+ assert_dom_equal(%(<link href=\"//bar.example.com/stylesheets/style.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />), stylesheet_link_tag(\"//bar.example.com/stylesheets/style.css\"))\n+ end\n+\n def test_should_wildcard_asset_host_between_zero_and_four\n @controller.config.asset_host = 'http://a%d.example.com'\n assert_match(%r(http://a[0123].example.com/collaboration/hieraki/images/xml.png), image_path('xml.png'))"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "e08ad04558b4e6e6ef84623f59332223b6c3eb59",
filename = "activemodel/lib/active_model/observer_array.rb",
status = "added", additions = 130L, deletions = 0L, changes = 130L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activemodel/lib/active_model/observer_array.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activemodel/lib/active_model/observer_array.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/lib/active_model/observer_array.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -0,0 +1,130 @@\n+require 'set'\n+\n+module ActiveModel\n+ # Stores the enabled/disabled state of individual observers for\n+ # a particular model classes.\n+ class ObserverArray < Array\n+ INSTANCES = Hash.new do |hash, model_class|\n+ hash[model_class] = new(model_class)\n+ end\n+\n+ def self.for(model_class)\n+ return nil unless model_class < ActiveModel::Observing\n+ INSTANCES[model_class]\n+ end\n+\n+ # Returns false if:\n+ # - the ObserverArray for the given model's class has the given observer\n+ # in its disabled_observers set.\n+ # - or that is the case at any level of the model's superclass chain.\n+ #\n+ # In other cases it returns true, since observers are enabled by default.\n+ def self.observer_enabled?(observer, model)\n+ klass = model.class\n+ observer_class = observer.class\n+\n+ loop do\n+ break unless array = self.for(klass)\n+ return false if array.disabled_observers.include?(observer_class)\n+ klass = klass.superclass\n+ end\n+\n+ true # observers are enabled by default\n+ end\n+\n+ def disabled_observers\n+ @disabled_observers ||= Set.new\n+ end\n+\n+ attr_reader :model_class\n+ def initialize(model_class, *args)\n+ @model_class = model_class\n+ super(*args)\n+ end\n+\n+ # Disable the given observers.\n+ def disable(*observers, &block)\n+ set_enablement(false, observers, &block)\n+ end\n+\n+ # Enable the given observers.\n+ def enable(*observers, &block)\n+ set_enablement(true, observers, &block)\n+ end\n+\n+ protected\n+\n+ def observer_class_for(observer)\n+ return observer if observer.is_a?(Class)\n+\n+ if observer.respond_to?(:to_sym) # string/symbol\n+ observer.to_s.camelize.constantize\n+ else\n+ raise ArgumentError, \"#{observer} was not a class or a \" +\n+ \"lowercase, underscored class name as expected.\"\n+ end\n+ end\n+\n+ def start_transaction\n+ disabled_observer_stack.push(disabled_observers.dup)\n+ each_subclass_array do |array|\n+ array.start_transaction\n+ end\n+ end\n+\n+ def disabled_observer_stack\n+ @disabled_observer_stack ||= []\n+ end\n+\n+ def end_transaction\n+ @disabled_observers = disabled_observer_stack.pop\n+ each_subclass_array do |array|\n+ array.end_transaction\n+ end\n+ end\n+\n+ def transaction\n+ start_transaction\n+\n+ begin\n+ yield\n+ ensure\n+ end_transaction\n+ end\n+ end\n+\n+ def each_subclass_array\n+ model_class.subclasses.each do |subclass|\n+ yield self.class.for(subclass)\n+ end\n+ end\n+\n+ def set_enablement(enabled, observers)\n+ if block_given?\n+ transaction do\n+ set_enablement(enabled, observers)\n+ yield\n+ end\n+ else\n+ observers = ActiveModel::Observer.all_observers if observers == [:all]\n+ observers.each do |obs|\n+ klass = observer_class_for(obs)\n+\n+ unless klass < ActiveModel::Observer\n+ raise ArgumentError.new(\"#{obs} does not refer to a valid observer\")\n+ end\n+\n+ if enabled\n+ disabled_observers.delete(klass)\n+ else\n+ disabled_observers << klass\n+ end\n+ end\n+\n+ each_subclass_array do |array|\n+ array.set_enablement(enabled, observers)\n+ end\n+ end\n+ end\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ba6be46670ced45e9d1231d16f1ca25421cc66d1",
filename = "activemodel/lib/active_model/observing.rb", status = "modified",
additions = 34L, deletions = 4L, changes = 38L, blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activemodel/lib/active_model/observing.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activemodel/lib/active_model/observing.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/lib/active_model/observing.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -1,8 +1,10 @@\n require 'singleton'\n+require 'active_model/observer_array'\n require 'active_support/core_ext/array/wrap'\n require 'active_support/core_ext/module/aliasing'\n require 'active_support/core_ext/module/remove_method'\n require 'active_support/core_ext/string/inflections'\n+require 'active_support/core_ext/enumerable'\n \n module ActiveModel\n module Observing\n@@ -30,12 +32,12 @@ module ClassMethods\n # +instantiate_observers+ is called during startup, and before\n # each development request.\n def observers=(*values)\n- @observers = values.flatten\n+ observers.replace(values.flatten)\n end\n \n # Gets the current observers.\n def observers\n- @observers ||= []\n+ @observers ||= ObserverArray.for(self)\n end\n \n # Gets the current observer instances.\n@@ -68,6 +70,10 @@ def count_observers\n observer_instances.size\n end\n \n+ def subclasses\n+ @subclasses ||= []\n+ end\n+\n protected\n def instantiate_observer(observer) #:nodoc:\n # string/symbol\n@@ -76,13 +82,18 @@ def instantiate_observer(observer) #:nodoc:\n elsif observer.respond_to?(:instance)\n observer.instance\n else\n- raise ArgumentError, \"#{observer} must be a lowercase, underscored class name (or an instance of the class itself) responding to the instance method. Example: Person.observers = :big_brother # calls BigBrother.instance\"\n+ raise ArgumentError,\n+ \"#{observer} must be a lowercase, underscored class name (or an \" +\n+ \"instance of the class itself) responding to the instance \" +\n+ \"method. Example: Person.observers = :big_brother # calls \" +\n+ \"BigBrother.instance\"\n end\n end\n \n # Notify observers when the observed class is subclassed.\n def inherited(subclass)\n super\n+ subclasses << subclass\n notify_observers :observed_class_inherited, subclass\n end\n end\n@@ -197,6 +208,23 @@ def observed_class\n nil\n end\n end\n+\n+ def subclasses\n+ @subclasses ||= []\n+ end\n+\n+ # List of all observer subclasses, sub-subclasses, etc.\n+ # Necessary so we can disable or enable all observers.\n+ def all_observers\n+ subclasses.each_with_object(subclasses.dup) do |subclass, array|\n+ array.concat(subclass.all_observers)\n+ end\n+ end\n+ end\n+\n+ def self.inherited(subclass)\n+ subclasses << subclass\n+ super\n end\n \n # Start observing the declared classes and their subclasses.\n@@ -210,7 +238,9 @@ def observed_classes #:nodoc:\n \n # Send observed_method(object) if the method exists.\n def update(observed_method, object) #:nodoc:\n- send(observed_method, object) if respond_to?(observed_method)\n+ if respond_to?(observed_method) && ObserverArray.observer_enabled?(self, object)\n+ send(observed_method, object)\n+ end\n end\n \n # Special method sent by the observed class when it is inherited."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "38e4fd59fc019f8d3d5dc83ddc02081ec32432df",
filename = "activemodel/test/cases/observer_array_test.rb",
status = "added", additions = 161L, deletions = 0L, changes = 161L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activemodel/test/cases/observer_array_test.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activemodel/test/cases/observer_array_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/test/cases/observer_array_test.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -0,0 +1,161 @@\n+require 'cases/helper'\n+require 'models/observers'\n+\n+class ObserverArrayTest < ActiveModel::TestCase\n+ def teardown\n+ ORM.observers.enable :all\n+ Budget.observers.enable :all\n+ Widget.observers.enable :all\n+ end\n+\n+ def assert_observer_notified(model_class, observer_class)\n+ observer_class.instance.before_save_invocations.clear\n+ model_instance = model_class.new\n+ model_instance.save\n+ assert_equal [model_instance], observer_class.instance.before_save_invocations\n+ end\n+\n+ def assert_observer_not_notified(model_class, observer_class)\n+ observer_class.instance.before_save_invocations.clear\n+ model_instance = model_class.new\n+ model_instance.save\n+ assert_equal [], observer_class.instance.before_save_invocations\n+ end\n+\n+ test \"all observers are enabled by default\" do\n+ assert_observer_notified Widget, WidgetObserver\n+ assert_observer_notified Budget, BudgetObserver\n+ assert_observer_notified Widget, AuditTrail\n+ assert_observer_notified Budget, AuditTrail\n+ end\n+\n+ test \"can disable individual observers using a class constant\" do\n+ ORM.observers.disable WidgetObserver\n+\n+ assert_observer_not_notified Widget, WidgetObserver\n+ assert_observer_notified Budget, BudgetObserver\n+ assert_observer_notified Widget, AuditTrail\n+ assert_observer_notified Budget, AuditTrail\n+ end\n+\n+ test \"can disable individual observers using a symbol\" do\n+ ORM.observers.disable :budget_observer\n+\n+ assert_observer_notified Widget, WidgetObserver\n+ assert_observer_not_notified Budget, BudgetObserver\n+ assert_observer_notified Widget, AuditTrail\n+ assert_observer_notified Budget, AuditTrail\n+ end\n+\n+ test \"can disable all observers using :all\" do\n+ ORM.observers.disable :all\n+\n+ assert_observer_not_notified Widget, WidgetObserver\n+ assert_observer_not_notified Budget, BudgetObserver\n+ assert_observer_not_notified Widget, AuditTrail\n+ assert_observer_not_notified Budget, AuditTrail\n+ end\n+\n+ test \"can disable observers on individual models without affecting observers on other models\" do\n+ Widget.observers.disable :all\n+\n+ assert_observer_not_notified Widget, WidgetObserver\n+ assert_observer_notified Budget, BudgetObserver\n+ assert_observer_not_notified Widget, AuditTrail\n+ assert_observer_notified Budget, AuditTrail\n+ end\n+\n+ test \"can disable observers for the duration of a block\" do\n+ yielded = false\n+ ORM.observers.disable :budget_observer do\n+ yielded = true\n+ assert_observer_notified Widget, WidgetObserver\n+ assert_observer_not_notified Budget, BudgetObserver\n+ assert_observer_notified Widget, AuditTrail\n+ assert_observer_notified Budget, AuditTrail\n+ end\n+\n+ assert yielded\n+ assert_observer_notified Widget, WidgetObserver\n+ assert_observer_notified Budget, BudgetObserver\n+ assert_observer_notified Widget, AuditTrail\n+ assert_observer_notified Budget, AuditTrail\n+ end\n+\n+ test \"can enable observers for the duration of a block\" do\n+ yielded = false\n+ Widget.observers.disable :all\n+\n+ Widget.observers.enable :all do\n+ yielded = true\n+ assert_observer_notified Widget, WidgetObserver\n+ assert_observer_notified Budget, BudgetObserver\n+ assert_observer_notified Widget, AuditTrail\n+ assert_observer_notified Budget, AuditTrail\n+ end\n+\n+ assert yielded\n+ assert_observer_not_notified Widget, WidgetObserver\n+ assert_observer_notified Budget, BudgetObserver\n+ assert_observer_not_notified Widget, AuditTrail\n+ assert_observer_notified Budget, AuditTrail\n+ end\n+\n+ test \"raises an appropriate error when a developer accidentally enables or disables the wrong class (i.e. Widget instead of WidgetObserver)\" do\n+ assert_raise ArgumentError do\n+ ORM.observers.enable :widget\n+ end\n+\n+ assert_raise ArgumentError do\n+ ORM.observers.enable Widget\n+ end\n+\n+ assert_raise ArgumentError do\n+ ORM.observers.disable :widget\n+ end\n+\n+ assert_raise ArgumentError do\n+ ORM.observers.disable Widget\n+ end\n+ end\n+\n+ test \"allows #enable at the superclass level to override #disable at the subclass level when called last\" do\n+ Widget.observers.disable :all\n+ ORM.observers.enable :all\n+\n+ assert_observer_notified Widget, WidgetObserver\n+ assert_observer_notified Budget, BudgetObserver\n+ assert_observer_notified Widget, AuditTrail\n+ assert_observer_notified Budget, AuditTrail\n+ end\n+\n+ test \"allows #disable at the superclass level to override #enable at the subclass level when called last\" do\n+ Budget.observers.enable :audit_trail\n+ ORM.observers.disable :audit_trail\n+\n+ assert_observer_notified Widget, WidgetObserver\n+ assert_observer_notified Budget, BudgetObserver\n+ assert_observer_not_notified Widget, AuditTrail\n+ assert_observer_not_notified Budget, AuditTrail\n+ end\n+\n+ test \"can use the block form at different levels of the hierarchy\" do\n+ yielded = false\n+ Widget.observers.disable :all\n+\n+ ORM.observers.enable :all do\n+ yielded = true\n+ assert_observer_notified Widget, WidgetObserver\n+ assert_observer_notified Budget, BudgetObserver\n+ assert_observer_notified Widget, AuditTrail\n+ assert_observer_notified Budget, AuditTrail\n+ end\n+\n+ assert yielded\n+ assert_observer_not_notified Widget, WidgetObserver\n+ assert_observer_notified Budget, BudgetObserver\n+ assert_observer_not_notified Widget, AuditTrail\n+ assert_observer_notified Budget, AuditTrail\n+ end\n+end\n+"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "99b1f407ae11844fb78c0ea72ac37d54f59d92fa",
filename = "activemodel/test/cases/observing_test.rb", status = "modified",
additions = 5L, deletions = 0L, changes = 5L, blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activemodel/test/cases/observing_test.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activemodel/test/cases/observing_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/test/cases/observing_test.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -43,6 +43,11 @@ def setup\n assert ObservedModel.observers.include?(:bar), \":bar not in #{ObservedModel.observers.inspect}\"\n end\n \n+ test \"uses an ObserverArray so observers can be disabled\" do\n+ ObservedModel.observers = [:foo, :bar]\n+ assert ObservedModel.observers.is_a?(ActiveModel::ObserverArray)\n+ end\n+\n test \"instantiates observer names passed as strings\" do\n ObservedModel.observers << 'foo_observer'\n FooObserver.expects(:instance)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "3729b3435efa1529653bf5597ad1d0aed879d3f8",
filename = "activemodel/test/models/observers.rb", status = "added",
additions = 27L, deletions = 0L, changes = 27L, blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activemodel/test/models/observers.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activemodel/test/models/observers.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/test/models/observers.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -0,0 +1,27 @@\n+class ORM\n+ include ActiveModel::Observing\n+\n+ def save\n+ notify_observers :before_save\n+ end\n+\n+ class Observer < ActiveModel::Observer\n+ def before_save_invocations\n+ @before_save_invocations ||= []\n+ end\n+\n+ def before_save(record)\n+ before_save_invocations << record\n+ end\n+ end\n+end\n+\n+class Widget < ORM; end\n+class Budget < ORM; end\n+class WidgetObserver < ORM::Observer; end\n+class BudgetObserver < ORM::Observer; end\n+class AuditTrail < ORM::Observer\n+ observe :widget, :budget\n+end\n+\n+ORM.instantiate_observers"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c545b9fbfc7d1ffae4f03a636b6e4bd66deab06f",
filename = "activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -90,7 +90,7 @@ def initialize(spec)\n h[table_name] = with_connection do |conn|\n \n # Fetch a list of columns\n- conn.columns(table_name, \"#{table_name} Columns\").tap do |columns|\n+ conn.columns(table_name).tap do |columns|\n \n # set primary key information\n columns.each do |column|"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c4d1e048e19645604f3646b648d53d8784fd6240",
filename = "activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -50,7 +50,7 @@ def index_exists?(table_name, column_name, options = {})\n \n # Returns an array of Column objects for the table specified by +table_name+.\n # See the concrete implementation for details on the expected parameter values.\n- def columns(table_name, name = nil) end\n+ def columns(table_name) end\n \n # Checks to see if a column exists in a given table.\n #"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d458d5545fde4f1e644dfd98410efa62903dd31c",
filename = "activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb",
status = "modified", additions = 2L, deletions = 1L, changes = 3L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -1,5 +1,6 @@\n # encoding: utf-8\n \n+gem 'mysql2', '~> 0.3.0'\n require 'mysql2'\n \n module ActiveRecord\n@@ -423,7 +424,7 @@ def indexes(table_name, name = nil)\n indexes\n end\n \n- def columns(table_name, name = nil)\n+ def columns(table_name)\n sql = \"SHOW FIELDS FROM #{quote_table_name(table_name)}\"\n columns = []\n result = execute(sql)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "5c0eb32731f30e3c7e50d8f12e0c147687d34c6a",
filename = "activerecord/lib/active_record/connection_adapters/mysql_adapter.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -625,7 +625,7 @@ def indexes(table_name, name = nil)#:nodoc:\n indexes\n end\n \n- def columns(table_name, name = nil)#:nodoc:\n+ def columns(table_name)#:nodoc:\n sql = \"SHOW FIELDS FROM #{quote_table_name(table_name)}\"\n columns = []\n result = execute(sql, 'SCHEMA')"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "e92a8617d86cc6a26624a2f8d4b5942c8094a38a",
filename = "activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -734,7 +734,7 @@ def indexes(table_name, name = nil)\n end\n \n # Returns the list of all column definitions for a table.\n- def columns(table_name, name = nil)\n+ def columns(table_name)\n # Limit, precision, and scale are all handled by the superclass.\n column_definitions(table_name).collect do |column_name, type, default, notnull|\n PostgreSQLColumn.new(column_name, default, type, notnull == 'f')"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "1917ccef712a9996bb888150dd5fd9865976b041",
filename = "activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -244,7 +244,7 @@ def tables(name = 'SCHEMA') #:nodoc:\n end\n end\n \n- def columns(table_name, name = nil) #:nodoc:\n+ def columns(table_name) #:nodoc:\n table_structure(table_name).map do |field|\n case field[\"dflt_value\"]\n when /^null$/i"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "cf38ff5f0476e84f70ccd30abc6b3c1a67000bc3",
filename = "activerecord/lib/active_record/reflection.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/lib/active_record/reflection.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/lib/active_record/reflection.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/reflection.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -242,8 +242,8 @@ def counter_cache_column\n end\n end\n \n- def columns(tbl_name, log_msg)\n- @columns ||= klass.connection.columns(tbl_name, log_msg)\n+ def columns(tbl_name)\n+ @columns ||= klass.connection.columns(tbl_name)\n end\n \n def reset_column_information"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "6eb9b7937964442f259e0cafabe91a0afd7fa3fe",
filename = "activerecord/test/active_record/connection_adapters/fake_adapter.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/test/active_record/connection_adapters/fake_adapter.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/test/active_record/connection_adapters/fake_adapter.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/active_record/connection_adapters/fake_adapter.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -28,7 +28,7 @@ def merge_column(table_name, name, sql_type = nil, options = {})\n options[:null])\n end\n \n- def columns(table_name, message)\n+ def columns(table_name)\n @columns[table_name]\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "2c051bff84595360f8b60251939e9cd32d2db5aa",
filename = "activerecord/test/cases/mass_assignment_security_test.rb",
status = "modified", additions = 9L, deletions = 9L, changes = 18L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/test/cases/mass_assignment_security_test.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/test/cases/mass_assignment_security_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/mass_assignment_security_test.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -35,10 +35,10 @@ def test_assign_attributes_uses_default_scope_when_no_scope_is_provided\n p = LoosePerson.new\n p.assign_attributes(attributes_hash)\n \n- assert_equal nil, p.id\n+ assert_equal nil, p.id\n assert_equal 'Josh', p.first_name\n- assert_equal 'male', p.gender\n- assert_equal nil, p.comments\n+ assert_equal 'm', p.gender\n+ assert_equal nil, p.comments\n end\n \n def test_assign_attributes_skips_mass_assignment_security_protection_when_without_protection_is_used\n@@ -47,7 +47,7 @@ def test_assign_attributes_skips_mass_assignment_security_protection_when_withou\n \n assert_equal 5, p.id\n assert_equal 'Josh', p.first_name\n- assert_equal 'male', p.gender\n+ assert_equal 'm', p.gender\n assert_equal 'rides a sweet bike', p.comments\n end\n \n@@ -57,7 +57,7 @@ def test_assign_attributes_with_default_scope_and_attr_protected_attributes\n \n assert_equal nil, p.id\n assert_equal 'Josh', p.first_name\n- assert_equal 'male', p.gender\n+ assert_equal 'm', p.gender\n assert_equal nil, p.comments\n end\n \n@@ -67,7 +67,7 @@ def test_assign_attributes_with_admin_scope_and_attr_protected_attributes\n \n assert_equal nil, p.id\n assert_equal 'Josh', p.first_name\n- assert_equal 'male', p.gender\n+ assert_equal 'm', p.gender\n assert_equal 'rides a sweet bike', p.comments\n end\n \n@@ -77,7 +77,7 @@ def test_assign_attributes_with_default_scope_and_attr_accessible_attributes\n \n assert_equal nil, p.id\n assert_equal 'Josh', p.first_name\n- assert_equal 'male', p.gender\n+ assert_equal 'm', p.gender\n assert_equal nil, p.comments\n end\n \n@@ -87,7 +87,7 @@ def test_assign_attributes_with_admin_scope_and_attr_accessible_attributes\n \n assert_equal nil, p.id\n assert_equal 'Josh', p.first_name\n- assert_equal 'male', p.gender\n+ assert_equal 'm', p.gender\n assert_equal 'rides a sweet bike', p.comments\n end\n \n@@ -107,7 +107,7 @@ def attributes_hash\n {\n :id => 5,\n :first_name => 'Josh',\n- :gender => 'male',\n+ :gender => 'm',\n :comments => 'rides a sweet bike'\n }\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c18517b321db7ee885a1036ab2df5f775c090fd0",
filename = "activerecord/test/cases/migration_test.rb", status = "modified",
additions = 4L, deletions = 5L, changes = 9L, blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/test/cases/migration_test.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/test/cases/migration_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/migration_test.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -905,20 +905,19 @@ def test_rename_table_with_an_index\n \n def test_change_column\n Person.connection.add_column 'people', 'age', :integer\n- label = \"test_change_column Columns\"\n- old_columns = Person.connection.columns(Person.table_name, label)\n+ old_columns = Person.connection.columns(Person.table_name)\n assert old_columns.find { |c| c.name == 'age' and c.type == :integer }\n \n assert_nothing_raised { Person.connection.change_column \"people\", \"age\", :string }\n \n- new_columns = Person.connection.columns(Person.table_name, label)\n+ new_columns = Person.connection.columns(Person.table_name)\n assert_nil new_columns.find { |c| c.name == 'age' and c.type == :integer }\n assert new_columns.find { |c| c.name == 'age' and c.type == :string }\n \n- old_columns = Topic.connection.columns(Topic.table_name, label)\n+ old_columns = Topic.connection.columns(Topic.table_name)\n assert old_columns.find { |c| c.name == 'approved' and c.type == :boolean and c.default == true }\n assert_nothing_raised { Topic.connection.change_column :topics, :approved, :boolean, :default => false }\n- new_columns = Topic.connection.columns(Topic.table_name, label)\n+ new_columns = Topic.connection.columns(Topic.table_name)\n assert_nil new_columns.find { |c| c.name == 'approved' and c.type == :boolean and c.default == true }\n assert new_columns.find { |c| c.name == 'approved' and c.type == :boolean and c.default == false }\n assert_nothing_raised { Topic.connection.change_column :topics, :approved, :boolean, :default => true }"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "b066575af8d459a534139689750341f74860e001",
filename = "activerecord/test/cases/persistence_test.rb",
status = "modified", additions = 17L, deletions = 17L, changes = 34L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/test/cases/persistence_test.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activerecord/test/cases/persistence_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/persistence_test.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -492,22 +492,22 @@ def test_update_attributes\n end\n \n def test_update_attributes_as_admin\n- person = TightPerson.create\n- person.update_attributes({ \"first_name\" => 'Josh', \"gender\" => 'male', \"comments\" => 'from NZ' }, :as => :admin)\n+ person = TightPerson.create({ \"first_name\" => 'Joshua' })\n+ person.update_attributes({ \"first_name\" => 'Josh', \"gender\" => 'm', \"comments\" => 'from NZ' }, :as => :admin)\n person.reload\n \n- assert_equal 'Josh', person.first_name\n- assert_equal 'male', person.gender\n+ assert_equal 'Josh', person.first_name\n+ assert_equal 'm', person.gender\n assert_equal 'from NZ', person.comments\n end\n \n- def test_update_attributes_as_without_protection\n- person = TightPerson.create\n- person.update_attributes({ \"first_name\" => 'Josh', \"gender\" => 'male', \"comments\" => 'from NZ' }, :without_protection => true)\n+ def test_update_attributes_without_protection\n+ person = TightPerson.create({ \"first_name\" => 'Joshua' })\n+ person.update_attributes({ \"first_name\" => 'Josh', \"gender\" => 'm', \"comments\" => 'from NZ' }, :without_protection => true)\n person.reload\n \n- assert_equal 'Josh', person.first_name\n- assert_equal 'male', person.gender\n+ assert_equal 'Josh', person.first_name\n+ assert_equal 'm', person.gender\n assert_equal 'from NZ', person.comments\n end\n \n@@ -532,23 +532,23 @@ def test_update_attributes!\n Reply.reset_callbacks(:validate)\n end\n \n- def test_update_attributes_as_admin\n- person = TightPerson.create\n- person.update_attributes!({ \"first_name\" => 'Josh', \"gender\" => 'male', \"comments\" => 'from NZ' }, :as => :admin)\n+ def test_update_attributes_with_bang_as_admin\n+ person = TightPerson.create({ \"first_name\" => 'Joshua' })\n+ person.update_attributes!({ \"first_name\" => 'Josh', \"gender\" => 'm', \"comments\" => 'from NZ' }, :as => :admin)\n person.reload\n \n assert_equal 'Josh', person.first_name\n- assert_equal 'male', person.gender\n+ assert_equal 'm', person.gender\n assert_equal 'from NZ', person.comments\n end\n \n- def test_update_attributes_as_without_protection\n- person = TightPerson.create\n- person.update_attributes!({ \"first_name\" => 'Josh', \"gender\" => 'male', \"comments\" => 'from NZ' }, :without_protection => true)\n+ def test_update_attributestes_with_bang_without_protection\n+ person = TightPerson.create({ \"first_name\" => 'Joshua' })\n+ person.update_attributes!({ \"first_name\" => 'Josh', \"gender\" => 'm', \"comments\" => 'from NZ' }, :without_protection => true)\n person.reload\n \n assert_equal 'Josh', person.first_name\n- assert_equal 'male', person.gender\n+ assert_equal 'm', person.gender\n assert_equal 'from NZ', person.comments\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "7c36393cf2daad949e99843ac5629fdd1ddb4fb0",
filename = "activeresource/test/connection_test.rb", status = "modified",
additions = 1L, deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activeresource/test/connection_test.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activeresource/test/connection_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/test/connection_test.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -50,7 +50,7 @@ def test_handle_response\n # 404 is a missing resource.\n assert_response_raises ActiveResource::ResourceNotFound, 404\n \n- # 405 is a missing not allowed error\n+ # 405 is a method not allowed error\n assert_response_raises ActiveResource::MethodNotAllowed, 405\n \n # 409 is an optimistic locking error"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "2df4fd1da10a443d9fe8d911c097990b6d0d1f69",
filename = "activesupport/lib/active_support/core_ext/array/access.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activesupport/lib/active_support/core_ext/array/access.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activesupport/lib/active_support/core_ext/array/access.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/lib/active_support/core_ext/array/access.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -3,10 +3,10 @@ class Array\n #\n # %w( a b c d ).from(0) # => %w( a b c d )\n # %w( a b c d ).from(2) # => %w( c d )\n- # %w( a b c d ).from(10) # => nil\n+ # %w( a b c d ).from(10) # => %w()\n # %w().from(0) # => %w()\n def from(position)\n- self[position..-1]\n+ self[position, length] || []\n end\n \n # Returns the beginning of the array up to +position+."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "0e5407bc353123243e16cba23b9b7b2f98f23a15",
filename = "activesupport/test/core_ext/array_ext_test.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activesupport/test/core_ext/array_ext_test.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/activesupport/test/core_ext/array_ext_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/test/core_ext/array_ext_test.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -10,7 +10,7 @@ class ArrayExtAccessTests < Test::Unit::TestCase\n def test_from\n assert_equal %w( a b c d ), %w( a b c d ).from(0)\n assert_equal %w( c d ), %w( a b c d ).from(2)\n- assert_nil %w( a b c d ).from(10)\n+ assert_equal %w(), %w( a b c d ).from(10)\n end\n \n def test_to"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "dfd3c654ffcb459368b804a3d06c9023fe9add8e",
filename = "railties/lib/rails/commands/console.rb", status = "modified",
additions = 1L, deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/railties/lib/rails/commands/console.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/railties/lib/rails/commands/console.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/commands/console.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -51,6 +51,6 @@ def start\n end\n \n # Has to set the RAILS_ENV before config/application is required\n-if ARGV.first && !ARGV.first.index(\"-\") && env = ARGV.pop # has to pop the env ARGV so IRB doesn't freak\n+if ARGV.first && !ARGV.first.index(\"-\") && env = ARGV.shift # has to shift the env ARGV so IRB doesn't freak\n ENV['RAILS_ENV'] = %w(production development test).detect {|e| e =~ /^#{env}/} || env\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "520d2c6a3a25b338846b8ecc9dd797ab338b2718",
filename = "railties/lib/rails/generators/app_base.rb", status = "modified",
additions = 3L, deletions = 3L, changes = 6L, blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/railties/lib/rails/generators/app_base.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/railties/lib/rails/generators/app_base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/app_base.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -135,14 +135,14 @@ def rails_gemfile_entry\n gem 'rails', :path => '#{Rails::Generators::RAILS_DEV_PATH}'\n gem 'arel', :git => 'git://github.com/rails/arel.git'\n gem 'rack', :git => 'git://github.com/rack/rack.git'\n- gem 'sprockets', :git => \"git://github.com/sstephenson/sprockets.git\"\n+ gem 'sprockets', :git => 'git://github.com/sstephenson/sprockets.git'\n GEMFILE\n elsif options.edge?\n <<-GEMFILE.strip_heredoc\n gem 'rails', :git => 'git://github.com/rails/rails.git'\n gem 'arel', :git => 'git://github.com/rails/arel.git'\n gem 'rack', :git => 'git://github.com/rack/rack.git'\n- gem 'sprockets', :git => \"git://github.com/sstephenson/sprockets.git\"\n+ gem 'sprockets', :git => 'git://github.com/sstephenson/sprockets.git'\n GEMFILE\n else\n <<-GEMFILE.strip_heredoc\n@@ -152,7 +152,7 @@ def rails_gemfile_entry\n # gem 'rails', :git => 'git://github.com/rails/rails.git'\n # gem 'arel', :git => 'git://github.com/rails/arel.git'\n # gem 'rack', :git => 'git://github.com/rack/rack.git'\n- # gem 'sprockets', :git => \"git://github.com/sstephenson/sprockets.git\"\n+ # gem 'sprockets', :git => 'git://github.com/sstephenson/sprockets.git'\n GEMFILE\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "8ad64e38edfc412200c03246232dd03ac3f00ad3",
filename = "railties/lib/rails/generators/rails/app/templates/Gemfile",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/railties/lib/rails/generators/rails/app/templates/Gemfile",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/railties/lib/rails/generators/rails/app/templates/Gemfile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/Gemfile?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -8,7 +8,7 @@ source 'http://rubygems.org'\n <%= \"gem 'json'\\n\" if RUBY_VERSION < \"1.9.2\" -%>\n gem 'sass'\n gem 'coffee-script'\n-# gem 'uglifier'\n+gem 'uglifier'\n \n # Use unicorn as the web server\n # gem 'unicorn'"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "9553f3bddefd92f4fe21b4ad9108d3dbb07878f3",
filename = "railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt",
status = "modified", additions = 4L, deletions = 4L, changes = 8L,
blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -11,14 +11,14 @@\n # Disable Rails's static asset server (Apache or nginx will already do this)\n config.serve_static_assets = false\n \n+ # Compress both stylesheets and JavaScripts\n+ config.assets.js_compressor = :uglifier\n+ config.assets.css_compressor = :scss\n+\n # Specifies the header that your server uses for sending files\n # (comment out if your front-end server doesn't support this)\n config.action_dispatch.x_sendfile_header = \"X-Sendfile\" # Use 'X-Accel-Redirect' for nginx\n \n- # Compress both stylesheets and JavaScripts\n- # config.assets.js_compressor = :uglifier\n- config.assets.css_compressor = :scss\n-\n # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.\n # config.force_ssl = true\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "0c588ba773465297c3abeb87d66f1e96123f8a84",
filename = "railties/test/railties/engine_test.rb", status = "modified",
additions = 1L, deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/54ca1f126df466df264376fe5c2a97c3d0b6abd3/railties/test/railties/engine_test.rb",
raw_url = "https://github.com/rails/rails/raw/54ca1f126df466df264376fe5c2a97c3d0b6abd3/railties/test/railties/engine_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/railties/engine_test.rb?ref=54ca1f126df466df264376fe5c2a97c3d0b6abd3",
patch = "@@ -624,7 +624,7 @@ def baz\n boot_rails\n require \"#{rails_root}/config/environment\"\n \n- methods = Bukkits::Engine.helpers.public_instance_methods.sort\n+ methods = Bukkits::Engine.helpers.public_instance_methods.collect(&:to_s).sort\n expected = [\"bar\", \"baz\"]\n assert_equal expected, methods\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:55 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 05:55:55 GMT",
etag = "\"3ee61c8981b42a253421455b8d855d4e\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248781:54D90243",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "a241e1a8264a6ace03db946c85b92db3"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "0085f542aabafa1b273f9c20a141545959d35b74", filename = "actionpack/lib/action_controller/test_case.rb",
status = "modified", additions = 3L, deletions = 1L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/78e581bd2f415b7a49e0fb7538ff6309b5ef2fdb/actionpack/lib/action_controller/test_case.rb",
raw_url = "https://github.com/rails/rails/raw/78e581bd2f415b7a49e0fb7538ff6309b5ef2fdb/actionpack/lib/action_controller/test_case.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_controller/test_case.rb?ref=78e581bd2f415b7a49e0fb7538ff6309b5ef2fdb",
patch = "@@ -147,7 +147,9 @@ def assign_parameters(routes, controller_path, action, parameters = {})\n if value.is_a? Fixnum\n value = value.to_s\n elsif value.is_a? Array\n- value = Result.new(value)\n+ value = Result.new(value.map { |v| v.is_a?(String) ? v.dup : v })\n+ elsif value.is_a? String\n+ value = value.dup\n end\n \n if extra_keys.include?(key.to_sym)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "5896222a0a9709428051ce09be10f72cca769337",
filename = "actionpack/test/controller/test_test.rb", status = "modified",
additions = 12L, deletions = 0L, changes = 12L, blob_url = "https://github.com/rails/rails/blob/78e581bd2f415b7a49e0fb7538ff6309b5ef2fdb/actionpack/test/controller/test_test.rb",
raw_url = "https://github.com/rails/rails/raw/78e581bd2f415b7a49e0fb7538ff6309b5ef2fdb/actionpack/test/controller/test_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/controller/test_test.rb?ref=78e581bd2f415b7a49e0fb7538ff6309b5ef2fdb",
patch = "@@ -493,6 +493,18 @@ def test_params_passing\n )\n end\n \n+ def test_params_passing_with_frozen_values\n+ assert_nothing_raised do\n+ get :test_params, :frozen => 'icy'.freeze, :frozens => ['icy'.freeze].freeze\n+ end\n+ parsed_params = eval(@response.body)\n+ assert_equal(\n+ {'controller' => 'test_test/test', 'action' => 'test_params',\n+ 'frozen' => 'icy', 'frozens' => ['icy']},\n+ parsed_params\n+ )\n+ end\n+\n def test_id_converted_to_string\n get :test_params, :id => 20, :foo => Object.new\n assert_kind_of String, @request.path_parameters['id']"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "b066575af8d459a534139689750341f74860e001",
filename = "activerecord/test/cases/persistence_test.rb",
status = "modified", additions = 7L, deletions = 7L, changes = 14L,
blob_url = "https://github.com/rails/rails/blob/78e581bd2f415b7a49e0fb7538ff6309b5ef2fdb/activerecord/test/cases/persistence_test.rb",
raw_url = "https://github.com/rails/rails/raw/78e581bd2f415b7a49e0fb7538ff6309b5ef2fdb/activerecord/test/cases/persistence_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/persistence_test.rb?ref=78e581bd2f415b7a49e0fb7538ff6309b5ef2fdb",
patch = "@@ -492,7 +492,7 @@ def test_update_attributes\n end\n \n def test_update_attributes_as_admin\n- person = TightPerson.create\n+ person = TightPerson.create({ \"first_name\" => 'Joshua' })\n person.update_attributes({ \"first_name\" => 'Josh', \"gender\" => 'm', \"comments\" => 'from NZ' }, :as => :admin)\n person.reload\n \n@@ -501,8 +501,8 @@ def test_update_attributes_as_admin\n assert_equal 'from NZ', person.comments\n end\n \n- def test_update_attributes_as_without_protection\n- person = TightPerson.create\n+ def test_update_attributes_without_protection\n+ person = TightPerson.create({ \"first_name\" => 'Joshua' })\n person.update_attributes({ \"first_name\" => 'Josh', \"gender\" => 'm', \"comments\" => 'from NZ' }, :without_protection => true)\n person.reload\n \n@@ -532,8 +532,8 @@ def test_update_attributes!\n Reply.reset_callbacks(:validate)\n end\n \n- def test_update_attributes_as_admin\n- person = TightPerson.create\n+ def test_update_attributes_with_bang_as_admin\n+ person = TightPerson.create({ \"first_name\" => 'Joshua' })\n person.update_attributes!({ \"first_name\" => 'Josh', \"gender\" => 'm', \"comments\" => 'from NZ' }, :as => :admin)\n person.reload\n \n@@ -542,8 +542,8 @@ def test_update_attributes_as_admin\n assert_equal 'from NZ', person.comments\n end\n \n- def test_update_attributes_as_without_protection\n- person = TightPerson.create\n+ def test_update_attributestes_with_bang_without_protection\n+ person = TightPerson.create({ \"first_name\" => 'Joshua' })\n person.update_attributes!({ \"first_name\" => 'Josh', \"gender\" => 'm', \"comments\" => 'from NZ' }, :without_protection => true)\n person.reload\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:55 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:36:00 GMT",
etag = "\"5b967508575b2498f760e9967d65ffb6\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2487AB:54D90243",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "c6c65e5196703428e7641f7d1e9bc353"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "c04110a994b6a5e424516ea65faea2e563613eaf", filename = "activerecord/lib/active_record/associations/association_collection.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/9f7ff621bd62ade37b4ae4e608bdf24b7f7b1456/activerecord/lib/active_record/associations/association_collection.rb",
raw_url = "https://github.com/rails/rails/raw/9f7ff621bd62ade37b4ae4e608bdf24b7f7b1456/activerecord/lib/active_record/associations/association_collection.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/associations/association_collection.rb?ref=9f7ff621bd62ade37b4ae4e608bdf24b7f7b1456",
patch = "@@ -381,7 +381,7 @@ def method_missing(method, *args, &block)\n when /^find_or_create_by_(.*)$/\n rest = $1\n find_args = pull_finder_args_from(DynamicFinderMatch.match(method).attribute_names, *args)\n- return send(\"find_by_#{rest}\", find_args) ||\n+ return send(\"find_by_#{rest}\", *find_args) ||\n method_missing(\"create_by_#{rest}\", *args, &block)\n when /^create_by_(.*)$/\n return create($1.split('_and_').zip(args).inject({}) { |h,kv| k,v=kv ; h[k] = v ; h }, &block)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "2f715a4631cf629e462c01d3bafcd7db8171cb0c",
filename = "activerecord/test/cases/associations/has_many_associations_test.rb",
status = "modified", additions = 9L, deletions = 0L, changes = 9L,
blob_url = "https://github.com/rails/rails/blob/9f7ff621bd62ade37b4ae4e608bdf24b7f7b1456/activerecord/test/cases/associations/has_many_associations_test.rb",
raw_url = "https://github.com/rails/rails/raw/9f7ff621bd62ade37b4ae4e608bdf24b7f7b1456/activerecord/test/cases/associations/has_many_associations_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/associations/has_many_associations_test.rb?ref=9f7ff621bd62ade37b4ae4e608bdf24b7f7b1456",
patch = "@@ -82,6 +82,15 @@ def test_find_or_create_by_with_additional_parameters\n assert_equal 4, post.comments.length\n end\n \n+ def test_find_or_create_by_with_same_parameters_creates_a_single_record\n+ author = Author.first\n+ assert_difference \"Post.count\", +1 do\n+ 2.times do\n+ author.posts.find_or_create_by_body_and_title('one', 'two')\n+ end\n+ end\n+ end\n+\n def test_find_or_create_by_with_block\n post = Post.create! :title => 'test_find_or_create_by_with_additional_parameters', :body => 'this is the body'\n comment = post.comments.find_or_create_by_body('other test comment body') { |comment| comment.type = 'test' }"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:55 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Wed, 01 Oct 2014 21:20:32 GMT",
etag = "\"17f1cc8067362c999760ca156c45fbf9\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2487C7:54D90243",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "7f48e2f7761567e923121f17538d7a6d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "d2ad7d4cf4db44d28fbf40c39fbb69dc7a018850", filename = "activesupport/lib/active_support/duration.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/c8d91789ab24fa0b33de313c9fe5ed29df9d351e/activesupport/lib/active_support/duration.rb",
raw_url = "https://github.com/rails/rails/raw/c8d91789ab24fa0b33de313c9fe5ed29df9d351e/activesupport/lib/active_support/duration.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/lib/active_support/duration.rb?ref=c8d91789ab24fa0b33de313c9fe5ed29df9d351e",
patch = "@@ -8,7 +8,7 @@ module ActiveSupport\n # Example:\n #\n # 1.month.ago # equivalent to Time.now.advance(:months => -1)\n- class Duration < BasicObject\n+ class Duration\n attr_accessor :value, :parts\n \n def initialize(value, parts) #:nodoc:"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "49f0965dbfdd755ea1dc9fb6eadee540ff7ecd57",
filename = "activesupport/test/core_ext/duration_test.rb",
status = "modified", additions = 10L, deletions = 1L, changes = 11L,
blob_url = "https://github.com/rails/rails/blob/c8d91789ab24fa0b33de313c9fe5ed29df9d351e/activesupport/test/core_ext/duration_test.rb",
raw_url = "https://github.com/rails/rails/raw/c8d91789ab24fa0b33de313c9fe5ed29df9d351e/activesupport/test/core_ext/duration_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/test/core_ext/duration_test.rb?ref=c8d91789ab24fa0b33de313c9fe5ed29df9d351e",
patch = "@@ -20,7 +20,6 @@ def test_threequals\n assert ActiveSupport::Duration === 1.day\n assert !(ActiveSupport::Duration === 1.day.to_i)\n assert !(ActiveSupport::Duration === 'foo')\n- assert !(ActiveSupport::Duration === ActiveSupport::BasicObject.new)\n end\n \n def test_equals\n@@ -40,6 +39,16 @@ def test_inspect\n assert_equal '14 days', 1.fortnight.inspect\n end\n \n+ def test_try\n+ assert 1.day.try(:is_a?, ActiveSupport::Duration),\n+ \"Duration#try should invoke Duration's instance methods\"\n+ end\n+\n+ def test_send\n+ assert 1.day.send(:is_a?, ActiveSupport::Duration),\n+ \"Duration#send should invoke Duration's instance methods\"\n+ end\n+\n def test_minus_with_duration_does_not_break_subtraction_of_date_from_date\n assert_nothing_raised { Date.today - Date.today }\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:55 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4612", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:09:06 GMT",
etag = "\"d7f295dd88084c8b016dd86c1bd63189\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2487E8:54D90243",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "01d096e6cfe28f8aea352e988c332cd3"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = FALSE, content = structure(list(
message = "Not Found", documentation_url = "https://developer.github.com/v3"), .Names = c("message",
"documentation_url")), headers = structure(list(server = "GitHub.com",
date = "Mon, 09 Feb 2015 18:53:55 GMT", `content-type` = "application/json; charset=utf-8",
`transfer-encoding` = "chunked", status = "404 Not Found",
`x-ratelimit-limit` = "5000", `x-ratelimit-remaining` = "4611",
`x-ratelimit-reset` = "1423510857", `x-oauth-scopes` = "",
`x-accepted-oauth-scopes` = "", `x-oauth-client-id` = "3f2c05f63b3d9cebf87f",
`x-github-media-type` = "github.v3", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248802:54D90243",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", `content-encoding` = "gzip"), .Names = c("server",
"date", "content-type", "transfer-encoding", "status", "x-ratelimit-limit",
"x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes",
"x-accepted-oauth-scopes", "x-oauth-client-id", "x-github-media-type",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "content-encoding"), class = c("insensitive",
"list")), code = 404L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "0d667a76a76b7d4dfa425b29fd931cda4f328e00", filename = "actionpack/actionpack.gemspec",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/502aaec92c9e15f1b784de4d2eee97f7c659069e/actionpack/actionpack.gemspec",
raw_url = "https://github.com/rails/rails/raw/502aaec92c9e15f1b784de4d2eee97f7c659069e/actionpack/actionpack.gemspec",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/actionpack.gemspec?ref=502aaec92c9e15f1b784de4d2eee97f7c659069e",
patch = "@@ -24,7 +24,7 @@ Gem::Specification.new do |s|\n s.add_dependency('i18n', '~> 0.6.0beta1')\n s.add_dependency('rack', '~> 1.2.1')\n s.add_dependency('rack-test', '~> 0.5.7')\n- s.add_dependency('rack-mount', '~> 0.7.1')\n+ s.add_dependency('rack-mount', '~> 0.7.2')\n s.add_dependency('tzinfo', '~> 0.3.23')\n s.add_dependency('erubis', '~> 2.7.0')\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:55 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4611", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 18:12:40 GMT",
etag = "\"dcafc1016940d74f83abd862dbd4a5d7\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248829:54D90243",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "c6c65e5196703428e7641f7d1e9bc353"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "cd478d8f9f4974bdf61928ee7e98f6fc8600986a", filename = "activemodel/lib/active_model/observer_array.rb",
status = "modified", additions = 5L, deletions = 1L, changes = 6L,
blob_url = "https://github.com/rails/rails/blob/505108b86976bf71091a772910a80c0722776139/activemodel/lib/active_model/observer_array.rb",
raw_url = "https://github.com/rails/rails/raw/505108b86976bf71091a772910a80c0722776139/activemodel/lib/active_model/observer_array.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/lib/active_model/observer_array.rb?ref=505108b86976bf71091a772910a80c0722776139",
patch = "@@ -13,10 +13,12 @@ def self.for(model_class)\n INSTANCES[model_class]\n end\n \n- # returns false if:\n+ # Returns false if:\n # - the ObserverArray for the given model's class has the given observer\n # in its disabled_observers set.\n # - or that is the case at any level of the model's superclass chain.\n+ #\n+ # On other cases it returns true, since observers are enabled by default.\n def self.observer_enabled?(observer, model)\n klass = model.class\n observer_class = observer.class\n@@ -40,10 +42,12 @@ def initialize(model_class, *args)\n super(*args)\n end\n \n+ # Disable the given observers.\n def disable(*observers, &block)\n set_enablement(false, observers, &block)\n end\n \n+ # Enable the given observers.\n def enable(*observers, &block)\n set_enablement(true, observers, &block)\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:56 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4611", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 05:55:55 GMT",
etag = "\"343ffaa9647c6b8660c53124b6d00428\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248842:54D90243",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "7f48e2f7761567e923121f17538d7a6d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = FALSE, content = structure(list(
message = "Not Found", documentation_url = "https://developer.github.com/v3"), .Names = c("message",
"documentation_url")), headers = structure(list(server = "GitHub.com",
date = "Mon, 09 Feb 2015 18:53:56 GMT", `content-type` = "application/json; charset=utf-8",
`transfer-encoding` = "chunked", status = "404 Not Found",
`x-ratelimit-limit` = "5000", `x-ratelimit-remaining` = "4610",
`x-ratelimit-reset` = "1423510857", `x-oauth-scopes` = "",
`x-accepted-oauth-scopes` = "", `x-oauth-client-id` = "3f2c05f63b3d9cebf87f",
`x-github-media-type` = "github.v3", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24885F:54D90244",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", `content-encoding` = "gzip"), .Names = c("server",
"date", "content-type", "transfer-encoding", "status", "x-ratelimit-limit",
"x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes",
"x-accepted-oauth-scopes", "x-oauth-client-id", "x-github-media-type",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "content-encoding"), class = c("insensitive",
"list")), code = 404L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = FALSE, content = structure(list(
message = "Not Found", documentation_url = "https://developer.github.com/v3"), .Names = c("message",
"documentation_url")), headers = structure(list(server = "GitHub.com",
date = "Mon, 09 Feb 2015 18:53:56 GMT", `content-type` = "application/json; charset=utf-8",
`transfer-encoding` = "chunked", status = "404 Not Found",
`x-ratelimit-limit` = "5000", `x-ratelimit-remaining` = "4609",
`x-ratelimit-reset` = "1423510857", `x-oauth-scopes` = "",
`x-accepted-oauth-scopes` = "", `x-oauth-client-id` = "3f2c05f63b3d9cebf87f",
`x-github-media-type` = "github.v3", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248876:54D90244",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", `content-encoding` = "gzip"), .Names = c("server",
"date", "content-type", "transfer-encoding", "status", "x-ratelimit-limit",
"x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes",
"x-accepted-oauth-scopes", "x-oauth-client-id", "x-github-media-type",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "content-encoding"), class = c("insensitive",
"list")), code = 404L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "3619b087876ac6df38c659985721e05daabc0bd3", filename = "actionpack/lib/action_controller/deprecated/base.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/6bcb352b8b2225de681015c19571f4612fba0029/actionpack/lib/action_controller/deprecated/base.rb",
raw_url = "https://github.com/rails/rails/raw/6bcb352b8b2225de681015c19571f4612fba0029/actionpack/lib/action_controller/deprecated/base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_controller/deprecated/base.rb?ref=6bcb352b8b2225de681015c19571f4612fba0029",
patch = "@@ -126,7 +126,7 @@ def filter_parameter_logging(*args, &block)\n # This was moved to a plugin\n def verify(*args)\n ActiveSupport::Deprecation.warn \"verify was removed from Rails and is now available as a plugin. \" \\\n- \"Please install it with `rails plugin install git://github.com/rails/verification.git`.\", caller\n+ \"Please install it with `rails plugin install git://github.com/sikachu/verification.git`.\", caller\n end\n \n def exempt_from_layout(*)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:56 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4609", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 02 Feb 2015 20:27:19 GMT",
etag = "\"324e7fb981e4a869effdda96dd71e8be\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24888B:54D90244",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "a30e6f9aa7cf5731b87dfb3b9992202d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "6cdec8c487b9f196f5d3dff55a4f1b169e60b18a", filename = "activerecord/lib/active_record/associations/collection_association.rb",
status = "modified", additions = 10L, deletions = 10L, changes = 20L,
blob_url = "https://github.com/rails/rails/blob/86d7ed33754f80690395309dd307c6d9ecc0022f/activerecord/lib/active_record/associations/collection_association.rb",
raw_url = "https://github.com/rails/rails/raw/86d7ed33754f80690395309dd307c6d9ecc0022f/activerecord/lib/active_record/associations/collection_association.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/associations/collection_association.rb?ref=86d7ed33754f80690395309dd307c6d9ecc0022f",
patch = "@@ -93,20 +93,20 @@ def last(*args)\n first_or_last(:last, *args)\n end\n \n- def build(attributes = {}, &block)\n- build_or_create(attributes, :build, &block)\n+ def build(attributes = {}, options = {}, &block)\n+ build_or_create(:build, attributes, options, &block)\n end\n \n- def create(attributes = {}, &block)\n+ def create(attributes = {}, options = {}, &block)\n unless owner.persisted?\n raise ActiveRecord::RecordNotSaved, \"You cannot call create unless the parent is saved\"\n end\n \n- build_or_create(attributes, :create, &block)\n+ build_or_create(:create, attributes, options, &block)\n end\n \n- def create!(attrs = {}, &block)\n- record = create(attrs, &block)\n+ def create!(attrs = {}, options = {}, &block)\n+ record = create(attrs, options, &block)\n Array.wrap(record).each(&:save!)\n record\n end\n@@ -403,9 +403,9 @@ def merge_target_lists(loaded, existing)\n end + existing\n end\n \n- def build_or_create(attributes, method)\n+ def build_or_create(method, attributes, options)\n records = Array.wrap(attributes).map do |attrs|\n- record = build_record(attrs)\n+ record = build_record(attrs, options)\n \n add_to_target(record) do\n yield(record) if block_given?\n@@ -421,8 +421,8 @@ def insert_record(record, validate = true)\n raise NotImplementedError\n end\n \n- def build_record(attributes)\n- reflection.build_association(scoped.scope_for_create.merge(attributes))\n+ def build_record(attributes, options)\n+ reflection.build_association(scoped.scope_for_create.merge(attributes), options)\n end\n \n def delete_or_destroy(records, method)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "7708228d23d2cc8edab0b2eb6c5c85c8e091ee23",
filename = "activerecord/lib/active_record/associations/has_many_through_association.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/86d7ed33754f80690395309dd307c6d9ecc0022f/activerecord/lib/active_record/associations/has_many_through_association.rb",
raw_url = "https://github.com/rails/rails/raw/86d7ed33754f80690395309dd307c6d9ecc0022f/activerecord/lib/active_record/associations/has_many_through_association.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/associations/has_many_through_association.rb?ref=86d7ed33754f80690395309dd307c6d9ecc0022f",
patch = "@@ -60,10 +60,10 @@ def through_record(record)\n through_record\n end\n \n- def build_record(attributes)\n+ def build_record(attributes, options = {})\n ensure_not_nested\n \n- record = super(attributes)\n+ record = super(attributes, options)\n \n inverse = source_reflection.inverse_of\n if inverse"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "ea4d73d414fa37691e7ac885109e00923076b061",
filename = "activerecord/lib/active_record/associations/singular_association.rb",
status = "modified", additions = 8L, deletions = 8L, changes = 16L,
blob_url = "https://github.com/rails/rails/blob/86d7ed33754f80690395309dd307c6d9ecc0022f/activerecord/lib/active_record/associations/singular_association.rb",
raw_url = "https://github.com/rails/rails/raw/86d7ed33754f80690395309dd307c6d9ecc0022f/activerecord/lib/active_record/associations/singular_association.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/associations/singular_association.rb?ref=86d7ed33754f80690395309dd307c6d9ecc0022f",
patch = "@@ -17,16 +17,16 @@ def writer(record)\n replace(record)\n end\n \n- def create(attributes = {})\n- new_record(:create, attributes)\n+ def create(attributes = {}, options = {})\n+ new_record(:create, attributes, options)\n end\n \n- def create!(attributes = {})\n- build(attributes).tap { |record| record.save! }\n+ def create!(attributes = {}, options = {})\n+ build(attributes, options).tap { |record| record.save! }\n end\n \n- def build(attributes = {})\n- new_record(:build, attributes)\n+ def build(attributes = {}, options = {})\n+ new_record(:build, attributes, options)\n end\n \n private\n@@ -44,9 +44,9 @@ def set_new_record(record)\n replace(record)\n end\n \n- def new_record(method, attributes)\n+ def new_record(method, attributes, options)\n attributes = scoped.scope_for_create.merge(attributes || {})\n- record = reflection.send(\"#{method}_association\", attributes)\n+ record = reflection.send(\"#{method}_association\", attributes, options)\n set_new_record(record)\n record\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "0ba401584d0e529b21d4a2e0eda2cdc9d0ec6c30",
filename = "activerecord/lib/active_record/base.rb", status = "modified",
additions = 28L, deletions = 5L, changes = 33L, blob_url = "https://github.com/rails/rails/blob/86d7ed33754f80690395309dd307c6d9ecc0022f/activerecord/lib/active_record/base.rb",
raw_url = "https://github.com/rails/rails/raw/86d7ed33754f80690395309dd307c6d9ecc0022f/activerecord/lib/active_record/base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/base.rb?ref=86d7ed33754f80690395309dd307c6d9ecc0022f",
patch = "@@ -475,10 +475,19 @@ def find_by_sql(sql, binds = [])\n # The +attributes+ parameter can be either be a Hash or an Array of Hashes. These Hashes describe the\n # attributes on the objects that are to be created.\n #\n+ # +create+ respects mass-assignment security and accepts either +:as+ or +:without_protection+ options\n+ # in the +options+ parameter.\n+ #\n # ==== Examples\n # # Create a single new object\n # User.create(:first_name => 'Jamie')\n #\n+ # # Create a single new object using the :admin mass-assignment security scope\n+ # User.create({ :first_name => 'Jamie', :is_admin => true }, :as => :admin)\n+ #\n+ # # Create a single new object bypassing mass-assignment security\n+ # User.create({ :first_name => 'Jamie', :is_admin => true }, :without_protection => true)\n+ #\n # # Create an Array of new objects\n # User.create([{ :first_name => 'Jamie' }, { :first_name => 'Jeremy' }])\n #\n@@ -491,11 +500,11 @@ def find_by_sql(sql, binds = [])\n # User.create([{ :first_name => 'Jamie' }, { :first_name => 'Jeremy' }]) do |u|\n # u.is_admin = false\n # end\n- def create(attributes = nil, &block)\n+ def create(attributes = nil, options = {}, &block)\n if attributes.is_a?(Array)\n- attributes.collect { |attr| create(attr, &block) }\n+ attributes.collect { |attr| create(attr, options, &block) }\n else\n- object = new(attributes)\n+ object = new(attributes, options)\n yield(object) if block_given?\n object.save\n object\n@@ -1484,7 +1493,20 @@ def encode_quoted_value(value) #:nodoc:\n # attributes but not yet saved (pass a hash with key names matching the associated table column names).\n # In both instances, valid attribute keys are determined by the column names of the associated table --\n # hence you can't have attributes that aren't part of the table columns.\n- def initialize(attributes = nil)\n+ #\n+ # +initialize+ respects mass-assignment security and accepts either +:as+ or +:without_protection+ options\n+ # in the +options+ parameter.\n+ #\n+ # ==== Examples\n+ # # Instantiates a single new object\n+ # User.new(:first_name => 'Jamie')\n+ #\n+ # # Instantiates a single new object using the :admin mass-assignment security scope\n+ # User.new({ :first_name => 'Jamie', :is_admin => true }, :as => :admin)\n+ #\n+ # # Instantiates a single new object bypassing mass-assignment security\n+ # User.new({ :first_name => 'Jamie', :is_admin => true }, :without_protection => true)\n+ def initialize(attributes = nil, options = {})\n @attributes = attributes_from_column_definition\n @association_cache = {}\n @aggregation_cache = {}\n@@ -1500,7 +1522,8 @@ def initialize(attributes = nil)\n set_serialized_attributes\n \n populate_with_current_scope_attributes\n- self.attributes = attributes unless attributes.nil?\n+\n+ assign_attributes(attributes, options) if attributes\n \n result = yield self if block_given?\n run_callbacks :initialize"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "fbbae99e8b15f1ad1eb248c5105064ecb396871b",
filename = "activerecord/test/cases/mass_assignment_security_test.rb",
status = "modified", additions = 397L, deletions = 33L, changes = 430L,
blob_url = "https://github.com/rails/rails/blob/86d7ed33754f80690395309dd307c6d9ecc0022f/activerecord/test/cases/mass_assignment_security_test.rb",
raw_url = "https://github.com/rails/rails/raw/86d7ed33754f80690395309dd307c6d9ecc0022f/activerecord/test/cases/mass_assignment_security_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/mass_assignment_security_test.rb?ref=86d7ed33754f80690395309dd307c6d9ecc0022f",
patch = "@@ -5,7 +5,63 @@\n require 'models/task'\n require 'models/person'\n \n+\n+module MassAssignmentTestHelpers\n+ def setup\n+ # another AR test modifies the columns which causes issues with create calls\n+ TightPerson.reset_column_information\n+ LoosePerson.reset_column_information\n+ end\n+\n+ def attributes_hash\n+ {\n+ :id => 5,\n+ :first_name => 'Josh',\n+ :gender => 'm',\n+ :comments => 'rides a sweet bike'\n+ }\n+ end\n+\n+ def assert_default_attributes(person, create = false)\n+ unless create\n+ assert_nil person.id\n+ else\n+ assert !!person.id\n+ end\n+ assert_equal 'Josh', person.first_name\n+ assert_equal 'm', person.gender\n+ assert_nil person.comments\n+ end\n+\n+ def assert_admin_attributes(person, create = false)\n+ unless create\n+ assert_nil person.id\n+ else\n+ assert !!person.id\n+ end\n+ assert_equal 'Josh', person.first_name\n+ assert_equal 'm', person.gender\n+ assert_equal 'rides a sweet bike', person.comments\n+ end\n+\n+ def assert_all_attributes(person)\n+ assert_equal 5, person.id\n+ assert_equal 'Josh', person.first_name\n+ assert_equal 'm', person.gender\n+ assert_equal 'rides a sweet bike', person.comments\n+ end\n+end\n+\n+module MassAssignmentRelationTestHelpers\n+ def setup\n+ super\n+ @person = LoosePerson.create(attributes_hash)\n+ end\n+end\n+\n+\n class MassAssignmentSecurityTest < ActiveRecord::TestCase\n+ include MassAssignmentTestHelpers\n \n def test_customized_primary_key_remains_protected\n subscriber = Subscriber.new(:nick => 'webster123', :name => 'nice try')\n@@ -35,60 +91,114 @@ def test_assign_attributes_uses_default_scope_when_no_scope_is_provided\n p = LoosePerson.new\n p.assign_attributes(attributes_hash)\n \n- assert_equal nil, p.id\n- assert_equal 'Josh', p.first_name\n- assert_equal 'm', p.gender\n- assert_equal nil, p.comments\n+ assert_default_attributes(p)\n end\n \n def test_assign_attributes_skips_mass_assignment_security_protection_when_without_protection_is_used\n p = LoosePerson.new\n p.assign_attributes(attributes_hash, :without_protection => true)\n \n- assert_equal 5, p.id\n- assert_equal 'Josh', p.first_name\n- assert_equal 'm', p.gender\n- assert_equal 'rides a sweet bike', p.comments\n+ assert_all_attributes(p)\n end\n \n def test_assign_attributes_with_default_scope_and_attr_protected_attributes\n p = LoosePerson.new\n p.assign_attributes(attributes_hash, :as => :default)\n \n- assert_equal nil, p.id\n- assert_equal 'Josh', p.first_name\n- assert_equal 'm', p.gender\n- assert_equal nil, p.comments\n+ assert_default_attributes(p)\n end\n \n def test_assign_attributes_with_admin_scope_and_attr_protected_attributes\n p = LoosePerson.new\n p.assign_attributes(attributes_hash, :as => :admin)\n \n- assert_equal nil, p.id\n- assert_equal 'Josh', p.first_name\n- assert_equal 'm', p.gender\n- assert_equal 'rides a sweet bike', p.comments\n+ assert_admin_attributes(p)\n end\n \n def test_assign_attributes_with_default_scope_and_attr_accessible_attributes\n p = TightPerson.new\n p.assign_attributes(attributes_hash, :as => :default)\n \n- assert_equal nil, p.id\n- assert_equal 'Josh', p.first_name\n- assert_equal 'm', p.gender\n- assert_equal nil, p.comments\n+ assert_default_attributes(p)\n end\n \n def test_assign_attributes_with_admin_scope_and_attr_accessible_attributes\n p = TightPerson.new\n p.assign_attributes(attributes_hash, :as => :admin)\n \n- assert_equal nil, p.id\n- assert_equal 'Josh', p.first_name\n- assert_equal 'm', p.gender\n- assert_equal 'rides a sweet bike', p.comments\n+ assert_admin_attributes(p)\n+ end\n+\n+ def test_new_with_attr_accessible_attributes\n+ p = TightPerson.new(attributes_hash)\n+\n+ assert_default_attributes(p)\n+ end\n+\n+ def test_new_with_attr_protected_attributes\n+ p = LoosePerson.new(attributes_hash)\n+\n+ assert_default_attributes(p)\n+ end\n+\n+ def test_create_with_attr_accessible_attributes\n+ p = TightPerson.create(attributes_hash)\n+\n+ assert_default_attributes(p, true)\n+ end\n+\n+ def test_create_with_attr_protected_attributes\n+ p = LoosePerson.create(attributes_hash)\n+\n+ assert_default_attributes(p, true)\n+ end\n+\n+ def test_new_with_admin_scope_with_attr_accessible_attributes\n+ p = TightPerson.new(attributes_hash, :as => :admin)\n+\n+ assert_admin_attributes(p)\n+ end\n+\n+ def test_new_with_admin_scope_with_attr_protected_attributes\n+ p = LoosePerson.new(attributes_hash, :as => :admin)\n+\n+ assert_admin_attributes(p)\n+ end\n+\n+ def test_create_with_admin_scope_with_attr_accessible_attributes\n+ p = TightPerson.create(attributes_hash, :as => :admin)\n+\n+ assert_admin_attributes(p, true)\n+ end\n+\n+ def test_create_with_admin_scope_with_attr_protected_attributes\n+ p = LoosePerson.create(attributes_hash, :as => :admin)\n+\n+ assert_admin_attributes(p, true)\n+ end\n+\n+ def test_new_with_without_protection_with_attr_accessible_attributes\n+ p = TightPerson.new(attributes_hash, :without_protection => true)\n+\n+ assert_all_attributes(p)\n+ end\n+\n+ def test_new_with_without_protection_with_attr_protected_attributes\n+ p = LoosePerson.new(attributes_hash, :without_protection => true)\n+\n+ assert_all_attributes(p)\n+ end\n+\n+ def test_create_with_without_protection_with_attr_accessible_attributes\n+ p = TightPerson.create(attributes_hash, :without_protection => true)\n+\n+ assert_all_attributes(p)\n+ end\n+\n+ def test_create_with_without_protection_with_attr_protected_attributes\n+ p = LoosePerson.create(attributes_hash, :without_protection => true)\n+\n+ assert_all_attributes(p)\n end\n \n def test_protection_against_class_attribute_writers\n@@ -101,14 +211,268 @@ def test_protection_against_class_attribute_writers\n end\n end\n \n- private\n+end\n \n- def attributes_hash\n- {\n- :id => 5,\n- :first_name => 'Josh',\n- :gender => 'm',\n- :comments => 'rides a sweet bike'\n- }\n+\n+class MassAssignmentSecurityHasOneRelationsTest < ActiveRecord::TestCase\n+ include MassAssignmentTestHelpers\n+ include MassAssignmentRelationTestHelpers\n+\n+ # build\n+\n+ def test_has_one_build_with_attr_protected_attributes\n+ best_friend = @person.build_best_friend(attributes_hash)\n+ assert_default_attributes(best_friend)\n+ end\n+\n+ def test_has_one_build_with_attr_accessible_attributes\n+ best_friend = @person.build_best_friend(attributes_hash)\n+ assert_default_attributes(best_friend)\n+ end\n+\n+ def test_has_one_build_with_admin_scope_with_attr_protected_attributes\n+ best_friend = @person.build_best_friend(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend)\n+ end\n+\n+ def test_has_one_build_with_admin_scope_with_attr_accessible_attributes\n+ best_friend = @person.build_best_friend(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend)\n+ end\n+\n+ def test_has_one_build_without_protection\n+ best_friend = @person.build_best_friend(attributes_hash, :without_protection => true)\n+ assert_all_attributes(best_friend)\n+ end\n+\n+ # create\n+\n+ def test_has_one_create_with_attr_protected_attributes\n+ best_friend = @person.create_best_friend(attributes_hash)\n+ assert_default_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_attr_accessible_attributes\n+ best_friend = @person.create_best_friend(attributes_hash)\n+ assert_default_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_admin_scope_with_attr_protected_attributes\n+ best_friend = @person.create_best_friend(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_admin_scope_with_attr_accessible_attributes\n+ best_friend = @person.create_best_friend(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend, true)\n end\n-end\n\\ No newline at end of file\n+\n+ def test_has_one_create_without_protection\n+ best_friend = @person.create_best_friend(attributes_hash, :without_protection => true)\n+ assert_all_attributes(best_friend)\n+ end\n+\n+ # create!\n+\n+ def test_has_one_create_with_bang_with_attr_protected_attributes\n+ best_friend = @person.create_best_friend!(attributes_hash)\n+ assert_default_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_bang_with_attr_accessible_attributes\n+ best_friend = @person.create_best_friend!(attributes_hash)\n+ assert_default_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_bang_with_admin_scope_with_attr_protected_attributes\n+ best_friend = @person.create_best_friend!(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_bang_with_admin_scope_with_attr_accessible_attributes\n+ best_friend = @person.create_best_friend!(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_bang_without_protection\n+ best_friend = @person.create_best_friend!(attributes_hash, :without_protection => true)\n+ assert_all_attributes(best_friend)\n+ end\n+\n+end\n+\n+\n+class MassAssignmentSecurityBelongsToRelationsTest < ActiveRecord::TestCase\n+ include MassAssignmentTestHelpers\n+ include MassAssignmentRelationTestHelpers\n+\n+ # build\n+\n+ def test_has_one_build_with_attr_protected_attributes\n+ best_friend = @person.build_best_friend_of(attributes_hash)\n+ assert_default_attributes(best_friend)\n+ end\n+\n+ def test_has_one_build_with_attr_accessible_attributes\n+ best_friend = @person.build_best_friend_of(attributes_hash)\n+ assert_default_attributes(best_friend)\n+ end\n+\n+ def test_has_one_build_with_admin_scope_with_attr_protected_attributes\n+ best_friend = @person.build_best_friend_of(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend)\n+ end\n+\n+ def test_has_one_build_with_admin_scope_with_attr_accessible_attributes\n+ best_friend = @person.build_best_friend_of(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend)\n+ end\n+\n+ def test_has_one_build_without_protection\n+ best_friend = @person.build_best_friend_of(attributes_hash, :without_protection => true)\n+ assert_all_attributes(best_friend)\n+ end\n+\n+ # create\n+\n+ def test_has_one_create_with_attr_protected_attributes\n+ best_friend = @person.create_best_friend_of(attributes_hash)\n+ assert_default_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_attr_accessible_attributes\n+ best_friend = @person.create_best_friend_of(attributes_hash)\n+ assert_default_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_admin_scope_with_attr_protected_attributes\n+ best_friend = @person.create_best_friend_of(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_admin_scope_with_attr_accessible_attributes\n+ best_friend = @person.create_best_friend_of(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_without_protection\n+ best_friend = @person.create_best_friend_of(attributes_hash, :without_protection => true)\n+ assert_all_attributes(best_friend)\n+ end\n+\n+ # create!\n+\n+ def test_has_one_create_with_bang_with_attr_protected_attributes\n+ best_friend = @person.create_best_friend!(attributes_hash)\n+ assert_default_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_bang_with_attr_accessible_attributes\n+ best_friend = @person.create_best_friend!(attributes_hash)\n+ assert_default_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_bang_with_admin_scope_with_attr_protected_attributes\n+ best_friend = @person.create_best_friend!(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_bang_with_admin_scope_with_attr_accessible_attributes\n+ best_friend = @person.create_best_friend!(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_bang_without_protection\n+ best_friend = @person.create_best_friend!(attributes_hash, :without_protection => true)\n+ assert_all_attributes(best_friend)\n+ end\n+\n+end\n+\n+\n+class MassAssignmentSecurityHasManyRelationsTest < ActiveRecord::TestCase\n+ include MassAssignmentTestHelpers\n+ include MassAssignmentRelationTestHelpers\n+\n+ # build\n+\n+ def test_has_one_build_with_attr_protected_attributes\n+ best_friend = @person.best_friends.build(attributes_hash)\n+ assert_default_attributes(best_friend)\n+ end\n+\n+ def test_has_one_build_with_attr_accessible_attributes\n+ best_friend = @person.best_friends.build(attributes_hash)\n+ assert_default_attributes(best_friend)\n+ end\n+\n+ def test_has_one_build_with_admin_scope_with_attr_protected_attributes\n+ best_friend = @person.best_friends.build(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend)\n+ end\n+\n+ def test_has_one_build_with_admin_scope_with_attr_accessible_attributes\n+ best_friend = @person.best_friends.build(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend)\n+ end\n+\n+ def test_has_one_build_without_protection\n+ best_friend = @person.best_friends.build(attributes_hash, :without_protection => true)\n+ assert_all_attributes(best_friend)\n+ end\n+\n+ # create\n+\n+ def test_has_one_create_with_attr_protected_attributes\n+ best_friend = @person.best_friends.create(attributes_hash)\n+ assert_default_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_attr_accessible_attributes\n+ best_friend = @person.best_friends.create(attributes_hash)\n+ assert_default_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_admin_scope_with_attr_protected_attributes\n+ best_friend = @person.best_friends.create(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_admin_scope_with_attr_accessible_attributes\n+ best_friend = @person.best_friends.create(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_without_protection\n+ best_friend = @person.best_friends.create(attributes_hash, :without_protection => true)\n+ assert_all_attributes(best_friend)\n+ end\n+\n+ # create!\n+\n+ def test_has_one_create_with_bang_with_attr_protected_attributes\n+ best_friend = @person.best_friends.create!(attributes_hash)\n+ assert_default_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_bang_with_attr_accessible_attributes\n+ best_friend = @person.best_friends.create!(attributes_hash)\n+ assert_default_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_bang_with_admin_scope_with_attr_protected_attributes\n+ best_friend = @person.best_friends.create!(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_bang_with_admin_scope_with_attr_accessible_attributes\n+ best_friend = @person.best_friends.create!(attributes_hash, :as => :admin)\n+ assert_admin_attributes(best_friend, true)\n+ end\n+\n+ def test_has_one_create_with_bang_without_protection\n+ best_friend = @person.best_friends.create!(attributes_hash, :without_protection => true)\n+ assert_all_attributes(best_friend)\n+ end\n+\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "a58c9bf572e0678b0c3dc1d2f6f12f08f3ec5ff2",
filename = "activerecord/test/models/person.rb", status = "modified",
additions = 17L, deletions = 6L, changes = 23L, blob_url = "https://github.com/rails/rails/blob/86d7ed33754f80690395309dd307c6d9ecc0022f/activerecord/test/models/person.rb",
raw_url = "https://github.com/rails/rails/raw/86d7ed33754f80690395309dd307c6d9ecc0022f/activerecord/test/models/person.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/models/person.rb?ref=86d7ed33754f80690395309dd307c6d9ecc0022f",
patch = "@@ -1,6 +1,6 @@\n class Person < ActiveRecord::Base\n has_many :readers\n- has_one :reader\n+ has_one :reader\n \n has_many :posts, :through => :readers\n has_many :posts_with_no_comments, :through => :readers, :source => :post, :include => :comments, :conditions => 'comments.id is null'\n@@ -8,23 +8,23 @@ class Person < ActiveRecord::Base\n has_many :references\n has_many :bad_references\n has_many :fixed_bad_references, :conditions => { :favourite => true }, :class_name => 'BadReference'\n- has_one :favourite_reference, :class_name => 'Reference', :conditions => ['favourite=?', true]\n+ has_one :favourite_reference, :class_name => 'Reference', :conditions => ['favourite=?', true]\n has_many :posts_with_comments_sorted_by_comment_id, :through => :readers, :source => :post, :include => :comments, :order => 'comments.id'\n \n has_many :jobs, :through => :references\n- has_many :jobs_with_dependent_destroy, :source => :job, :through => :references, :dependent => :destroy\n+ has_many :jobs_with_dependent_destroy, :source => :job, :through => :references, :dependent => :destroy\n has_many :jobs_with_dependent_delete_all, :source => :job, :through => :references, :dependent => :delete_all\n- has_many :jobs_with_dependent_nullify, :source => :job, :through => :references, :dependent => :nullify\n+ has_many :jobs_with_dependent_nullify, :source => :job, :through => :references, :dependent => :nullify\n \n belongs_to :primary_contact, :class_name => 'Person'\n has_many :agents, :class_name => 'Person', :foreign_key => 'primary_contact_id'\n has_many :agents_of_agents, :through => :agents, :source => :agents\n belongs_to :number1_fan, :class_name => 'Person'\n \n- has_many :agents_posts, :through => :agents, :source => :posts\n+ has_many :agents_posts, :through => :agents, :source => :posts\n has_many :agents_posts_authors, :through => :agents_posts, :source => :author\n \n- scope :males, :conditions => { :gender => 'M' }\n+ scope :males, :conditions => { :gender => 'M' }\n scope :females, :conditions => { :gender => 'F' }\n end\n \n@@ -56,14 +56,25 @@ class LoosePerson < ActiveRecord::Base\n \n attr_protected :comments\n attr_protected :as => :admin\n+\n+ has_one :best_friend, :class_name => 'LoosePerson', :foreign_key => :best_friend_id\n+ belongs_to :best_friend_of, :class_name => 'LoosePerson', :foreign_key => :best_friend_of_id\n+\n+ has_many :best_friends, :class_name => 'LoosePerson', :foreign_key => :best_friend_id\n end\n \n class LooseDescendant < LoosePerson; end\n \n class TightPerson < ActiveRecord::Base\n self.table_name = 'people'\n+\n attr_accessible :first_name, :gender\n attr_accessible :first_name, :gender, :comments, :as => :admin\n+\n+ has_one :best_friend, :class_name => 'TightPerson', :foreign_key => :best_friend_id\n+ belongs_to :best_friend_of, :class_name => 'TightPerson', :foreign_key => :best_friend_of_id\n+\n+ has_many :best_friends, :class_name => 'TightPerson', :foreign_key => :best_friend_id\n end\n \n class TightDescendant < TightPerson; end\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "9479242e4f5fc0dd5973465aa6fbb2f0ff784a02",
filename = "activerecord/test/schema/schema.rb", status = "modified",
additions = 2L, deletions = 0L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/86d7ed33754f80690395309dd307c6d9ecc0022f/activerecord/test/schema/schema.rb",
raw_url = "https://github.com/rails/rails/raw/86d7ed33754f80690395309dd307c6d9ecc0022f/activerecord/test/schema/schema.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/schema/schema.rb?ref=86d7ed33754f80690395309dd307c6d9ecc0022f",
patch = "@@ -438,6 +438,8 @@ def create_table(*args, &block)\n t.references :number1_fan\n t.integer :lock_version, :null => false, :default => 0\n t.string :comments\n+ t.references :best_friend\n+ t.references :best_friend_of\n t.timestamps\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:56 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4609", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:36:00 GMT",
etag = "\"8aa10e333bd120fc5fdf640c6ebde347\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2488A6:54D90244",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "065b43cd9674091fec48a221b420fbb3"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "f692b169df7a59dd6c9bf0d51a6a277fb992e0ee", filename = "actionpack/CHANGELOG",
status = "modified", additions = 4L, deletions = 0L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/8c9e4d520291871e5319bc0e0a890527d8aea099/actionpack/CHANGELOG",
raw_url = "https://github.com/rails/rails/raw/8c9e4d520291871e5319bc0e0a890527d8aea099/actionpack/CHANGELOG",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/CHANGELOG?ref=8c9e4d520291871e5319bc0e0a890527d8aea099",
patch = "@@ -1,5 +1,9 @@\n *Rails 3.1.0 (unreleased)*\n \n+* Add `ActionController::ParamsWrapper` to wrap parameters into a nested hash, and will be turned on for JSON request in new applications by default [Prem Sichanugrist]\n+\n+ This can be customizabled by setting `ActionController::Base.wrap_parameters` in `config/initializer/wrap_parameters.rb`\n+\n * RJS has been extracted out to a gem. [fxn]\n \n * Implicit actions named not_implemented can be rendered [Santiago Pastorino]"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "eba5e9377b96412024bb6716d211c0e192b914cf",
filename = "actionpack/lib/action_controller.rb", status = "modified",
additions = 1L, deletions = 0L, changes = 1L, blob_url = "https://github.com/rails/rails/blob/8c9e4d520291871e5319bc0e0a890527d8aea099/actionpack/lib/action_controller.rb",
raw_url = "https://github.com/rails/rails/raw/8c9e4d520291871e5319bc0e0a890527d8aea099/actionpack/lib/action_controller.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_controller.rb?ref=8c9e4d520291871e5319bc0e0a890527d8aea099",
patch = "@@ -23,6 +23,7 @@ module ActionController\n autoload :ImplicitRender\n autoload :Instrumentation\n autoload :MimeResponds\n+ autoload :ParamsWrapper\n autoload :RackDelegation\n autoload :Redirecting\n autoload :Renderers"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "373df7fb5596165354e3bf1706b955e15497ca23",
filename = "actionpack/lib/action_controller/base.rb", status = "modified",
additions = 1L, deletions = 0L, changes = 1L, blob_url = "https://github.com/rails/rails/blob/8c9e4d520291871e5319bc0e0a890527d8aea099/actionpack/lib/action_controller/base.rb",
raw_url = "https://github.com/rails/rails/raw/8c9e4d520291871e5319bc0e0a890527d8aea099/actionpack/lib/action_controller/base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_controller/base.rb?ref=8c9e4d520291871e5319bc0e0a890527d8aea099",
patch = "@@ -194,6 +194,7 @@ def self.without_modules(*modules)\n Caching,\n MimeResponds,\n ImplicitRender,\n+ ParamsWrapper,\n \n Cookies,\n Flash,"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "29ff546139dfb159dfea48f55fe5276601d52820",
filename = "actionpack/lib/action_controller/metal/params_wrapper.rb",
status = "added", additions = 197L, deletions = 0L, changes = 197L,
blob_url = "https://github.com/rails/rails/blob/8c9e4d520291871e5319bc0e0a890527d8aea099/actionpack/lib/action_controller/metal/params_wrapper.rb",
raw_url = "https://github.com/rails/rails/raw/8c9e4d520291871e5319bc0e0a890527d8aea099/actionpack/lib/action_controller/metal/params_wrapper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_controller/metal/params_wrapper.rb?ref=8c9e4d520291871e5319bc0e0a890527d8aea099",
patch = "@@ -0,0 +1,197 @@\n+require 'active_support/core_ext/class/attribute'\n+require 'action_dispatch/http/mime_types'\n+\n+module ActionController\n+ # Wraps parameters hash into nested hash. This will allow client to submit\n+ # POST request without having to specify a root element in it.\n+ #\n+ # By default, this functionality won't be enabled by default. You can enable\n+ # it globally by setting +ActionController::Base.wrap_parameters+:\n+ #\n+ # ActionController::Base.wrap_parameters = [:json]\n+ #\n+ # You could also turn it on per controller by setting the format array to\n+ # non-empty array:\n+ #\n+ # class UsersController < ApplicationController\n+ # wrap_parameters :format => [:json, :xml]\n+ # end\n+ #\n+ # If you enable +ParamsWrapper+ for +:json+ format. Instead of having to\n+ # send JSON parameters like this:\n+ #\n+ # {\"user\": {\"name\": \"Konata\"}}\n+ #\n+ # You can now just send a parameters like this:\n+ #\n+ # {\"name\": \"Konata\"}\n+ #\n+ # And it will be wrapped into a nested hash with the key name matching\n+ # controller's name. For example, if you're posting to +UsersController+,\n+ # your new +params+ hash will look like this:\n+ #\n+ # {\"name\" => \"Konata\", \"user\" => {\"name\" => \"Konata\"}}\n+ #\n+ # You can also specify the key in which the parameters should be wrapped to,\n+ # and also the list of attributes it should wrap by using either +:only+ or\n+ # +:except+ options like this:\n+ #\n+ # class UsersController < ApplicationController\n+ # wrap_parameters :person, :only => [:username, :password]\n+ # end\n+ #\n+ # If you're going to pass the parameters to an +ActiveModel+ object (such as\n+ # +User.new(params[:user])+), you might consider passing the model class to\n+ # the method instead. The +ParamsWrapper+ will actually try to determine the\n+ # list of attribute names from the model and only wrap those attributes:\n+ #\n+ # class UsersController < ApplicationController\n+ # wrap_parameters Person\n+ # end\n+ #\n+ # You still could pass +:only+ and +:except+ to set the list of attributes\n+ # you want to wrap.\n+ #\n+ # By default, if you don't specify the key in which the parameters would be\n+ # wrapped to, +ParamsWrapper+ will actually try to determine if there's\n+ # a model related to it or not. This controller, for example:\n+ #\n+ # class Admin::UsersController < ApplicationController\n+ # end\n+ #\n+ # will try to check if +Admin::User+ or +User+ model exists, and use it to\n+ # determine the wrapper key respectively. If both of the model doesn't exists,\n+ # it will then fallback to use +user+ as the key.\n+ module ParamsWrapper\n+ extend ActiveSupport::Concern\n+\n+ EXCLUDE_PARAMETERS = %w(authenticity_token _method utf8)\n+\n+ included do\n+ class_attribute :_wrapper_options\n+ self._wrapper_options = {:format => []}\n+ end\n+\n+ module ClassMethods\n+ # Sets the name of the wrapper key, or the model which +ParamsWrapper+\n+ # would use to determine the attribute names from.\n+ #\n+ # ==== Examples\n+ # wrap_parameters :format => :xml\n+ # # enables the parmeter wrappes for XML format\n+ #\n+ # wrap_parameters :person\n+ # # wraps parameters into +params[:person]+ hash\n+ #\n+ # wrap_parameters Person\n+ # # wraps parameters by determine the wrapper key from Person class\n+ # (+person+, in this case) and the list of attribute names\n+ #\n+ # wrap_parameters :only => [:username, :title]\n+ # # wraps only +:username+ and +:title+ attributes from parameters.\n+ #\n+ # wrap_parameters false\n+ # # disable parameters wrapping for this controller altogether.\n+ #\n+ # ==== Options\n+ # * <tt>:format</tt> - The list of formats in which the parameters wrapper\n+ # will be enabled.\n+ # * <tt>:only</tt> - The list of attribute names which parmeters wrapper\n+ # will wrap into a nested hash.\n+ # * <tt>:only</tt> - The list of attribute names which parmeters wrapper\n+ # will exclude from a nested hash.\n+ def wrap_parameters(name_or_model_or_options, options = {})\n+ if !name_or_model_or_options.is_a? Hash\n+ if name_or_model_or_options != false\n+ options = options.merge(:name_or_model => name_or_model_or_options)\n+ else\n+ options = opions.merge(:format => [])\n+ end\n+ else\n+ options = name_or_model_or_options\n+ end\n+\n+ options[:name_or_model] ||= _default_wrap_model\n+ self._wrapper_options = self._wrapper_options.merge(options)\n+ end\n+\n+ # Sets the default wrapper key or model which will be used to determine\n+ # wrapper key and attribute names. Will be called automatically when the\n+ # module is inherited.\n+ def inherited(klass)\n+ if klass._wrapper_options[:format].present?\n+ klass._wrapper_options = klass._wrapper_options.merge(:name_or_model => klass._default_wrap_model)\n+ end\n+ super\n+ end\n+\n+ # Determine the wrapper model from the controller's name. By convention,\n+ # this could be done by trying to find the defined model that has the\n+ # same singularize name as the controller. For example, +UsersController+\n+ # will try to find if the +User+ model exists.\n+ def _default_wrap_model\n+ model_name = self.name.sub(/Controller$/, '').singularize\n+\n+ begin\n+ model_klass = model_name.constantize\n+ rescue NameError => e\n+ unscoped_model_name = model_name.split(\"::\", 2).last\n+ break if unscoped_model_name == model_name\n+ model_name = unscoped_model_name\n+ end until model_klass\n+\n+ model_klass\n+ end\n+ end\n+\n+ # Performs parameters wrapping upon the request. Will be called automatically\n+ # by the metal call stack.\n+ def process_action(*args)\n+ if _wrapper_enabled?\n+ wrapped_hash = { _wrapper_key => request.request_parameters.slice(*_wrapped_keys) }\n+ wrapped_filtered_hash = { _wrapper_key => request.filtered_parameters.slice(*_wrapped_keys) }\n+\n+ # This will make the wrapped hash accessible from controller and view\n+ request.parameters.merge! wrapped_hash\n+ request.request_parameters.merge! wrapped_hash\n+\n+ # This will make the wrapped hash displayed in the log file\n+ request.filtered_parameters.merge! wrapped_filtered_hash\n+ end\n+ super\n+ end\n+\n+ private\n+ # Returns the wrapper key which will use to stored wrapped parameters.\n+ def _wrapper_key\n+ @_wrapper_key ||= if _wrapper_options[:name_or_model]\n+ _wrapper_options[:name_or_model].to_s.demodulize.underscore\n+ else\n+ self.class.controller_name.singularize\n+ end\n+ end\n+\n+ # Returns the list of parameters which will be selected for wrapped.\n+ def _wrapped_keys\n+ @_wrapped_keys ||= if _wrapper_options[:only]\n+ Array(_wrapper_options[:only]).collect(&:to_s)\n+ elsif _wrapper_options[:except]\n+ request.request_parameters.keys - Array(_wrapper_options[:except]).collect(&:to_s) - EXCLUDE_PARAMETERS\n+ elsif _wrapper_options[:name_or_model].respond_to?(:column_names)\n+ _wrapper_options[:name_or_model].column_names\n+ else\n+ request.request_parameters.keys - EXCLUDE_PARAMETERS\n+ end\n+ end\n+\n+ # Returns the list of enabled formats.\n+ def _wrapper_formats\n+ Array(_wrapper_options[:format])\n+ end\n+\n+ # Checks if we should perform parameters wrapping.\n+ def _wrapper_enabled?\n+ _wrapper_formats.any?{ |format| format == request.content_mime_type.try(:ref) } && request.request_parameters[_wrapper_key].nil?\n+ end\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "2e5d096fcd9e9b76577934c006d63c790eb2e027",
filename = "actionpack/test/controller/params_wrapper_test.rb",
status = "added", additions = 187L, deletions = 0L, changes = 187L,
blob_url = "https://github.com/rails/rails/blob/8c9e4d520291871e5319bc0e0a890527d8aea099/actionpack/test/controller/params_wrapper_test.rb",
raw_url = "https://github.com/rails/rails/raw/8c9e4d520291871e5319bc0e0a890527d8aea099/actionpack/test/controller/params_wrapper_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/controller/params_wrapper_test.rb?ref=8c9e4d520291871e5319bc0e0a890527d8aea099",
patch = "@@ -0,0 +1,187 @@\n+require 'abstract_unit'\n+\n+module Admin; class User; end; end\n+\n+class ParamsWrapperTest < ActionController::TestCase\n+ class UsersController < ActionController::Base\n+ def test\n+ render :json => params.except(:controller, :action)\n+ end\n+ end\n+\n+ class User; end\n+ class Person; end\n+\n+ tests UsersController\n+\n+ def test_derivered_name_from_controller\n+ with_default_wrapper_options do\n+ @request.env['CONTENT_TYPE'] = 'application/json'\n+ post :test, { 'username' => 'sikachu' }\n+ assert_equal '{\"username\":\"sikachu\",\"user\":{\"username\":\"sikachu\"}}', @response.body\n+ end\n+ end\n+\n+ def test_specify_wrapper_name\n+ with_default_wrapper_options do\n+ UsersController.wrap_parameters :person\n+\n+ @request.env['CONTENT_TYPE'] = 'application/json'\n+ post :test, { 'username' => 'sikachu' }\n+ assert_equal '{\"username\":\"sikachu\",\"person\":{\"username\":\"sikachu\"}}', @response.body\n+ end\n+ end\n+\n+ def test_specify_wrapper_model\n+ with_default_wrapper_options do\n+ UsersController.wrap_parameters Person\n+\n+ @request.env['CONTENT_TYPE'] = 'application/json'\n+ post :test, { 'username' => 'sikachu' }\n+ assert_equal '{\"username\":\"sikachu\",\"person\":{\"username\":\"sikachu\"}}', @response.body\n+ end\n+ end\n+\n+ def test_specify_only_option\n+ with_default_wrapper_options do\n+ UsersController.wrap_parameters :only => :username\n+\n+ @request.env['CONTENT_TYPE'] = 'application/json'\n+ post :test, { 'username' => 'sikachu', 'title' => 'Developer' }\n+ assert_equal '{\"username\":\"sikachu\",\"title\":\"Developer\",\"user\":{\"username\":\"sikachu\"}}', @response.body\n+ end\n+ end\n+\n+ def test_specify_except_option\n+ with_default_wrapper_options do\n+ UsersController.wrap_parameters :except => :title\n+\n+ @request.env['CONTENT_TYPE'] = 'application/json'\n+ post :test, { 'username' => 'sikachu', 'title' => 'Developer' }\n+ assert_equal '{\"username\":\"sikachu\",\"title\":\"Developer\",\"user\":{\"username\":\"sikachu\"}}', @response.body\n+ end\n+ end\n+\n+ def test_specify_both_wrapper_name_and_only_option\n+ with_default_wrapper_options do\n+ UsersController.wrap_parameters :person, :only => :username\n+\n+ @request.env['CONTENT_TYPE'] = 'application/json'\n+ post :test, { 'username' => 'sikachu', 'title' => 'Developer' }\n+ assert_equal '{\"username\":\"sikachu\",\"title\":\"Developer\",\"person\":{\"username\":\"sikachu\"}}', @response.body\n+ end\n+ end\n+\n+ def test_not_enabled_format\n+ with_default_wrapper_options do\n+ @request.env['CONTENT_TYPE'] = 'application/xml'\n+ post :test, { 'username' => 'sikachu', 'title' => 'Developer' }\n+ assert_equal '{\"username\":\"sikachu\",\"title\":\"Developer\"}', @response.body\n+ end\n+ end\n+\n+ def test_specify_format\n+ with_default_wrapper_options do\n+ UsersController.wrap_parameters :format => :xml\n+\n+ @request.env['CONTENT_TYPE'] = 'application/xml'\n+ post :test, { 'username' => 'sikachu', 'title' => 'Developer' }\n+ assert_equal '{\"username\":\"sikachu\",\"title\":\"Developer\",\"user\":{\"username\":\"sikachu\",\"title\":\"Developer\"}}', @response.body\n+ end\n+ end\n+\n+ def test_not_wrap_reserved_parameters\n+ with_default_wrapper_options do\n+ @request.env['CONTENT_TYPE'] = 'application/json'\n+ post :test, { 'authenticity_token' => 'pwned', '_method' => 'put', 'utf8' => '&#9731;', 'username' => 'sikachu' }\n+ assert_equal '{\"authenticity_token\":\"pwned\",\"_method\":\"put\",\"utf8\":\"&#9731;\",\"username\":\"sikachu\",\"user\":{\"username\":\"sikachu\"}}', @response.body\n+ end\n+ end\n+\n+ def test_no_double_wrap_if_key_exists\n+ with_default_wrapper_options do\n+ @request.env['CONTENT_TYPE'] = 'application/json'\n+ post :test, { 'user' => { 'username' => 'sikachu' }}\n+ assert_equal '{\"user\":{\"username\":\"sikachu\"}}', @response.body\n+ end\n+ end\n+\n+ def test_nested_params\n+ with_default_wrapper_options do\n+ @request.env['CONTENT_TYPE'] = 'application/json'\n+ post :test, { 'person' => { 'username' => 'sikachu' }}\n+ assert_equal '{\"person\":{\"username\":\"sikachu\"},\"user\":{\"person\":{\"username\":\"sikachu\"}}}', @response.body\n+ end\n+ end\n+\n+ def test_derived_wrapped_keys_from_matching_model\n+ with_default_wrapper_options do\n+ User.expects(:respond_to?).with(:column_names).returns(true)\n+ User.expects(:column_names).returns([\"username\"])\n+\n+ @request.env['CONTENT_TYPE'] = 'application/json'\n+ post :test, { 'username' => 'sikachu', 'title' => 'Developer' }\n+ assert_equal '{\"username\":\"sikachu\",\"title\":\"Developer\",\"user\":{\"username\":\"sikachu\"}}', @response.body\n+ end\n+ end\n+\n+ def test_derived_wrapped_keys_from_specified_model\n+ with_default_wrapper_options do\n+ Person.expects(:respond_to?).with(:column_names).returns(true)\n+ Person.expects(:column_names).returns([\"username\"])\n+\n+ UsersController.wrap_parameters Person\n+\n+ @request.env['CONTENT_TYPE'] = 'application/json'\n+ post :test, { 'username' => 'sikachu', 'title' => 'Developer' }\n+ assert_equal '{\"username\":\"sikachu\",\"title\":\"Developer\",\"person\":{\"username\":\"sikachu\"}}', @response.body\n+ end\n+ end\n+\n+ private\n+ def with_default_wrapper_options(&block)\n+ @controller.class._wrapper_options = {:format => [:json]}\n+ @controller.class.inherited(@controller.class)\n+ yield\n+ end\n+end\n+\n+class NamespacedParamsWrapperTest < ActionController::TestCase\n+ module Admin\n+ class UsersController < ActionController::Base\n+ def test\n+ render :json => params.except(:controller, :action)\n+ end\n+ end\n+\n+ class User; end\n+ end\n+ class User; end\n+ class Person; end\n+\n+ tests Admin::UsersController\n+\n+ def test_derivered_name_from_controller\n+ with_default_wrapper_options do\n+ @request.env['CONTENT_TYPE'] = 'application/json'\n+ post :test, { 'username' => 'sikachu' }\n+ assert_equal '{\"username\":\"sikachu\",\"user\":{\"username\":\"sikachu\"}}', @response.body\n+ end\n+ end\n+\n+ def test_namespace_lookup_when_namespaced_model_available\n+ with_default_wrapper_options do\n+ Admin::User.expects(:respond_to?).with(:column_names).returns(false)\n+\n+ @request.env['CONTENT_TYPE'] = 'application/json'\n+ post :test, { 'username' => 'sikachu' }\n+ end\n+ end\n+\n+ private\n+ def with_default_wrapper_options(&block)\n+ @controller.class._wrapper_options = {:format => [:json]}\n+ @controller.class.inherited(@controller.class)\n+ yield\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d854d55173e351e7bc4dc56d0eb72328060952a3",
filename = "actionpack/test/dispatch/request/json_params_parsing_test.rb",
status = "modified", additions = 53L, deletions = 0L, changes = 53L,
blob_url = "https://github.com/rails/rails/blob/8c9e4d520291871e5319bc0e0a890527d8aea099/actionpack/test/dispatch/request/json_params_parsing_test.rb",
raw_url = "https://github.com/rails/rails/raw/8c9e4d520291871e5319bc0e0a890527d8aea099/actionpack/test/dispatch/request/json_params_parsing_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/dispatch/request/json_params_parsing_test.rb?ref=8c9e4d520291871e5319bc0e0a890527d8aea099",
patch = "@@ -63,3 +63,56 @@ def with_test_routing\n end\n end\n end\n+\n+class RootLessJSONParamsParsingTest < ActionDispatch::IntegrationTest\n+ class UsersController < ActionController::Base\n+ wrap_parameters :format => :json\n+\n+ class << self\n+ attr_accessor :last_request_parameters, :last_parameters\n+ end\n+\n+ def parse\n+ self.class.last_request_parameters = request.request_parameters\n+ self.class.last_parameters = params\n+ head :ok\n+ end\n+ end\n+\n+ def teardown\n+ UsersController.last_request_parameters = nil\n+ end\n+\n+ test \"parses json params for application json\" do\n+ assert_parses(\n+ {\"user\" => {\"username\" => \"sikachu\"}, \"username\" => \"sikachu\"},\n+ \"{\\\"username\\\": \\\"sikachu\\\"}\", { 'CONTENT_TYPE' => 'application/json' }\n+ )\n+ end\n+\n+ test \"parses json params for application jsonrequest\" do\n+ assert_parses(\n+ {\"user\" => {\"username\" => \"sikachu\"}, \"username\" => \"sikachu\"},\n+ \"{\\\"username\\\": \\\"sikachu\\\"}\", { 'CONTENT_TYPE' => 'application/jsonrequest' }\n+ )\n+ end\n+\n+ private\n+ def assert_parses(expected, actual, headers = {})\n+ with_test_routing(UsersController) do\n+ post \"/parse\", actual, headers\n+ assert_response :ok\n+ assert_equal(expected, UsersController.last_request_parameters)\n+ assert_equal(expected.merge({\"action\" => \"parse\"}), UsersController.last_parameters)\n+ end\n+ end\n+\n+ def with_test_routing(controller)\n+ with_routing do |set|\n+ set.draw do\n+ match ':action', :to => controller\n+ end\n+ yield\n+ end\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "38453dfe482bda69bc29b2c2e84102143e9a8510",
filename = "actionpack/test/dispatch/request/xml_params_parsing_test.rb",
status = "modified", additions = 38L, deletions = 0L, changes = 38L,
blob_url = "https://github.com/rails/rails/blob/8c9e4d520291871e5319bc0e0a890527d8aea099/actionpack/test/dispatch/request/xml_params_parsing_test.rb",
raw_url = "https://github.com/rails/rails/raw/8c9e4d520291871e5319bc0e0a890527d8aea099/actionpack/test/dispatch/request/xml_params_parsing_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/dispatch/request/xml_params_parsing_test.rb?ref=8c9e4d520291871e5319bc0e0a890527d8aea099",
patch = "@@ -115,3 +115,41 @@ def default_headers\n {'HTTP_X_POST_DATA_FORMAT' => 'xml'}\n end\n end\n+\n+class RootLessXmlParamsParsingTest < ActionDispatch::IntegrationTest\n+ class TestController < ActionController::Base\n+ wrap_parameters :person, :format => :xml\n+\n+ class << self\n+ attr_accessor :last_request_parameters\n+ end\n+\n+ def parse\n+ self.class.last_request_parameters = request.request_parameters\n+ head :ok\n+ end\n+ end\n+\n+ def teardown\n+ TestController.last_request_parameters = nil\n+ end\n+\n+ test \"parses hash params\" do\n+ with_test_routing do\n+ xml = \"<name>David</name>\"\n+ post \"/parse\", xml, {'CONTENT_TYPE' => 'application/xml'}\n+ assert_response :ok\n+ assert_equal({\"name\" => \"David\", \"person\" => {\"name\" => \"David\"}}, TestController.last_request_parameters)\n+ end\n+ end\n+\n+ private\n+ def with_test_routing\n+ with_routing do |set|\n+ set.draw do\n+ match ':action', :to => ::RootLessXmlParamsParsingTest::TestController\n+ end\n+ yield\n+ end\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "60137ed2bbcfb147d810911ea622caf411df6739",
filename = "railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt",
status = "added", additions = 12L, deletions = 0L, changes = 12L,
blob_url = "https://github.com/rails/rails/blob/8c9e4d520291871e5319bc0e0a890527d8aea099/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt",
raw_url = "https://github.com/rails/rails/raw/8c9e4d520291871e5319bc0e0a890527d8aea099/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt?ref=8c9e4d520291871e5319bc0e0a890527d8aea099",
patch = "@@ -0,0 +1,12 @@\n+# Be sure to restart your server when you modify this file.\n+#\n+# This file contains the settings for ActionController::ParametersWrapper\n+# which will be enabled by default in the upcoming version of Ruby on Rails.\n+\n+# Enable parameter wrapping for JSON. You can disable this by set :format to empty array.\n+ActionController::Base.wrap_parameters :format => [:json]\n+\n+# Disable root element in JSON by default.\n+if defined?(ActiveRecord)\n+ ActiveRecord::Base.include_root_in_json = false\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "8f96f4c57ba494bd89469f7b2c794171b60f5544",
filename = "railties/test/application/configuration_test.rb",
status = "modified", additions = 10L, deletions = 0L, changes = 10L,
blob_url = "https://github.com/rails/rails/blob/8c9e4d520291871e5319bc0e0a890527d8aea099/railties/test/application/configuration_test.rb",
raw_url = "https://github.com/rails/rails/raw/8c9e4d520291871e5319bc0e0a890527d8aea099/railties/test/application/configuration_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/application/configuration_test.rb?ref=8c9e4d520291871e5319bc0e0a890527d8aea099",
patch = "@@ -432,5 +432,15 @@ def index\n get \"/\"\n assert_equal 'true', last_response.body\n end\n+\n+ test \"config.action_controller.wrap_parameters is set in ActionController::Base\" do\n+ app_file 'config/initializers/wrap_parameters.rb', <<-RUBY\n+ ActionController::Base.wrap_parameters :format => [:json]\n+ RUBY\n+ require \"#{app_path}/config/environment\"\n+ require 'action_controller/base'\n+\n+ assert_equal [:json], ActionController::Base._wrapper_options[:format]\n+ end\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:56 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4609", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:48:06 GMT",
etag = "\"22bd231dd413a1acb8fb0271c563b1fe\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2488C6:54D90244",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "173530fed4bbeb1e264b2ed22e8b5c20"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "e4df7a38a402fca884585f8cc4666033e5acc2c0", filename = "activeresource/examples/performance.rb",
status = "added", additions = 70L, deletions = 0L, changes = 70L,
blob_url = "https://github.com/rails/rails/blob/a962bfe47232200c20dce02047201247d24d77f7/activeresource/examples/performance.rb",
raw_url = "https://github.com/rails/rails/raw/a962bfe47232200c20dce02047201247d24d77f7/activeresource/examples/performance.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/examples/performance.rb?ref=a962bfe47232200c20dce02047201247d24d77f7",
patch = "@@ -0,0 +1,70 @@\n+require 'rubygems'\n+require 'active_resource'\n+require 'benchmark'\n+\n+TIMES = (ENV['N'] || 10_000).to_i\n+\n+# deep nested resource\n+attrs = {\n+ :id => 1,\n+ :name => 'Luis',\n+ :age => 21,\n+ :friends => [\n+ {\n+ :name => 'JK',\n+ :age => 24,\n+ :colors => ['red', 'green', 'blue'],\n+ :brothers => [\n+ {\n+ :name => 'Mateo',\n+ :age => 35,\n+ :children => [{ :name => 'Edith', :age => 5 }, { :name => 'Martha', :age => 4 }]\n+ },\n+ {\n+ :name => 'Felipe',\n+ :age => 33,\n+ :children => [{ :name => 'Bryan', :age => 1 }, { :name => 'Luke', :age => 0 }]\n+ }\n+ ]\n+ },\n+ {\n+ :name => 'Eduardo',\n+ :age => 20,\n+ :colors => [],\n+ :brothers => [\n+ {\n+ :name => 'Sebas',\n+ :age => 23,\n+ :children => [{ :name => 'Andres', :age => 0 }, { :name => 'Jorge', :age => 2 }]\n+ },\n+ {\n+ :name => 'Elsa',\n+ :age => 19,\n+ :children => [{ :name => 'Natacha', :age => 1 }]\n+ },\n+ {\n+ :name => 'Milena',\n+ :age => 16,\n+ :children => []\n+ }\n+ ]\n+ }\n+ ]\n+}\n+\n+class Customer < ActiveResource::Base\n+ self.site = \"http://37s.sunrise.i:3000\"\n+end\n+\n+module Nested\n+ class Customer < ActiveResource::Base\n+ self.site = \"http://37s.sunrise.i:3000\"\n+ end\n+end\n+\n+Benchmark.bm(40) do |x|\n+ x.report('Model.new (instantiation)') { TIMES.times { Customer.new } }\n+ x.report('Nested::Model.new (instantiation)') { TIMES.times { Nested::Customer.new } }\n+ x.report('Model.new (setting attributes)') { TIMES.times { Customer.new attrs } }\n+ x.report('Nested::Model.new (setting attributes)') { TIMES.times { Nested::Customer.new attrs } }\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "7f2a844723d437a52116e22ca5a9f4630719fb9a",
filename = "activeresource/lib/active_resource/base.rb",
status = "modified", additions = 24L, deletions = 15L, changes = 39L,
blob_url = "https://github.com/rails/rails/blob/a962bfe47232200c20dce02047201247d24d77f7/activeresource/lib/active_resource/base.rb",
raw_url = "https://github.com/rails/rails/raw/a962bfe47232200c20dce02047201247d24d77f7/activeresource/lib/active_resource/base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/base.rb?ref=a962bfe47232200c20dce02047201247d24d77f7",
patch = "@@ -1239,9 +1239,10 @@ def load(attributes)\n @attributes[key.to_s] =\n case value\n when Array\n- resource = find_or_create_resource_for_collection(key)\n+ resource = nil\n value.map do |attrs|\n if attrs.is_a?(Hash)\n+ resource ||= find_or_create_resource_for_collection(key)\n resource.new(attrs)\n else\n attrs.duplicable? ? attrs.dup : attrs\n@@ -1251,7 +1252,7 @@ def load(attributes)\n resource = find_or_create_resource_for(key)\n resource.new(value)\n else\n- value.dup rescue value\n+ value.duplicable? ? value.dup : value\n end\n end\n self\n@@ -1367,36 +1368,44 @@ def find_or_create_resource_for_collection(name)\n end\n \n # Tries to find a resource in a non empty list of nested modules\n- # Raises a NameError if it was not found in any of the given nested modules\n- def find_resource_in_modules(resource_name, module_names)\n+ # if it fails, then the resource is created\n+ def find_or_create_resource_in_modules(resource_name, module_names)\n receiver = Object\n namespaces = module_names[0, module_names.size-1].map do |module_name|\n receiver = receiver.const_get(module_name)\n end\n const_args = RUBY_VERSION < \"1.9\" ? [resource_name] : [resource_name, false]\n if namespace = namespaces.reverse.detect { |ns| ns.const_defined?(*const_args) }\n- return namespace.const_get(*const_args)\n+ namespace.const_get(*const_args)\n else\n- raise NameError\n+ create_resource_for(resource_name)\n end\n end\n \n # Tries to find a resource for a given name; if it fails, then the resource is created\n def find_or_create_resource_for(name)\n resource_name = name.to_s.camelize\n- ancestors = self.class.name.split(\"::\")\n- if ancestors.size > 1\n- find_resource_in_modules(resource_name, ancestors)\n- else\n- self.class.const_get(resource_name)\n- end\n- rescue NameError\n+\n const_args = RUBY_VERSION < \"1.9\" ? [resource_name] : [resource_name, false]\n if self.class.const_defined?(*const_args)\n- resource = self.class.const_get(*const_args)\n+ self.class.const_get(*const_args)\n else\n- resource = self.class.const_set(resource_name, Class.new(ActiveResource::Base))\n+ ancestors = self.class.name.split(\"::\")\n+ if ancestors.size > 1\n+ find_or_create_resource_in_modules(resource_name, ancestors)\n+ else\n+ if Object.const_defined?(*const_args)\n+ Object.const_get(*const_args)\n+ else\n+ create_resource_for(resource_name)\n+ end\n+ end\n end\n+ end\n+\n+ # Create and return a class definition for a resource inside the current resource\n+ def create_resource_for(resource_name)\n+ resource = self.class.const_set(resource_name, Class.new(ActiveResource::Base))\n resource.prefix = self.class.prefix\n resource.site = self.class.site\n resource"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:56 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4609", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 17:47:28 GMT",
etag = "\"9a8dcfd4e67af8bf117704f1aa04b47c\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2488E1:54D90244",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "07ff1c8a09e44b62e277fae50a1b1dc4"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = FALSE, content = structure(list(
message = "Not Found", documentation_url = "https://developer.github.com/v3"), .Names = c("message",
"documentation_url")), headers = structure(list(server = "GitHub.com",
date = "Mon, 09 Feb 2015 18:53:56 GMT", `content-type` = "application/json; charset=utf-8",
`transfer-encoding` = "chunked", status = "404 Not Found",
`x-ratelimit-limit` = "5000", `x-ratelimit-remaining` = "4608",
`x-ratelimit-reset` = "1423510857", `x-oauth-scopes` = "",
`x-accepted-oauth-scopes` = "", `x-oauth-client-id` = "3f2c05f63b3d9cebf87f",
`x-github-media-type` = "github.v3", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2488F8:54D90244",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", `content-encoding` = "gzip"), .Names = c("server",
"date", "content-type", "transfer-encoding", "status", "x-ratelimit-limit",
"x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes",
"x-accepted-oauth-scopes", "x-oauth-client-id", "x-github-media-type",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "content-encoding"), class = c("insensitive",
"list")), code = 404L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = FALSE, content = structure(list(
message = "Not Found", documentation_url = "https://developer.github.com/v3"), .Names = c("message",
"documentation_url")), headers = structure(list(server = "GitHub.com",
date = "Mon, 09 Feb 2015 18:53:56 GMT", `content-type` = "application/json; charset=utf-8",
`transfer-encoding` = "chunked", status = "404 Not Found",
`x-ratelimit-limit` = "5000", `x-ratelimit-remaining` = "4607",
`x-ratelimit-reset` = "1423510857", `x-oauth-scopes` = "",
`x-accepted-oauth-scopes` = "", `x-oauth-client-id` = "3f2c05f63b3d9cebf87f",
`x-github-media-type` = "github.v3", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F24890F:54D90244",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", `content-encoding` = "gzip"), .Names = c("server",
"date", "content-type", "transfer-encoding", "status", "x-ratelimit-limit",
"x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes",
"x-accepted-oauth-scopes", "x-oauth-client-id", "x-github-media-type",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "content-encoding"), class = c("insensitive",
"list")), code = 404L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "22bc69601d37024249055e0b6ed808fe7639b4c7", filename = "activeresource/examples/performance.rb",
status = "added", additions = 74L, deletions = 0L, changes = 74L,
blob_url = "https://github.com/rails/rails/blob/1b42dbd8a94bf653d0a513e8e7063ec8338c268b/activeresource/examples/performance.rb",
raw_url = "https://github.com/rails/rails/raw/1b42dbd8a94bf653d0a513e8e7063ec8338c268b/activeresource/examples/performance.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/examples/performance.rb?ref=1b42dbd8a94bf653d0a513e8e7063ec8338c268b",
patch = "@@ -0,0 +1,74 @@\n+require 'rubygems'\n+require 'benchmark'\n+\n+__DIR__ = File.dirname(__FILE__)\n+$:.unshift \"#{__DIR__}/../lib\"\n+$:.unshift \"#{__DIR__}/../../activesupport/lib\"\n+require 'active_resource'\n+\n+TIMES = (ENV['N'] || 10_000).to_i\n+\n+# deep nested resource\n+attrs = {\n+ :id => 1,\n+ :name => 'Luis',\n+ :age => 21,\n+ :friends => [\n+ {\n+ :name => 'JK',\n+ :age => 24,\n+ :colors => ['red', 'green', 'blue'],\n+ :brothers => [\n+ {\n+ :name => 'Mateo',\n+ :age => 35,\n+ :children => [{ :name => 'Edith', :age => 5 }, { :name => 'Martha', :age => 4 }]\n+ },\n+ {\n+ :name => 'Felipe',\n+ :age => 33,\n+ :children => [{ :name => 'Bryan', :age => 1 }, { :name => 'Luke', :age => 0 }]\n+ }\n+ ]\n+ },\n+ {\n+ :name => 'Eduardo',\n+ :age => 20,\n+ :colors => [],\n+ :brothers => [\n+ {\n+ :name => 'Sebas',\n+ :age => 23,\n+ :children => [{ :name => 'Andres', :age => 0 }, { :name => 'Jorge', :age => 2 }]\n+ },\n+ {\n+ :name => 'Elsa',\n+ :age => 19,\n+ :children => [{ :name => 'Natacha', :age => 1 }]\n+ },\n+ {\n+ :name => 'Milena',\n+ :age => 16,\n+ :children => []\n+ }\n+ ]\n+ }\n+ ]\n+}\n+\n+class Customer < ActiveResource::Base\n+ self.site = \"http://37s.sunrise.i:3000\"\n+end\n+\n+module Nested\n+ class Customer < ActiveResource::Base\n+ self.site = \"http://37s.sunrise.i:3000\"\n+ end\n+end\n+\n+Benchmark.bm(40) do |x|\n+ x.report('Model.new (instantiation)') { TIMES.times { Customer.new } }\n+ x.report('Nested::Model.new (instantiation)') { TIMES.times { Nested::Customer.new } }\n+ x.report('Model.new (setting attributes)') { TIMES.times { Customer.new attrs } }\n+ x.report('Nested::Model.new (setting attributes)') { TIMES.times { Nested::Customer.new attrs } }\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "07c31d55cfd38edcf37642bb82919e2667488342",
filename = "activeresource/lib/active_resource/base.rb",
status = "modified", additions = 31L, deletions = 20L, changes = 51L,
blob_url = "https://github.com/rails/rails/blob/1b42dbd8a94bf653d0a513e8e7063ec8338c268b/activeresource/lib/active_resource/base.rb",
raw_url = "https://github.com/rails/rails/raw/1b42dbd8a94bf653d0a513e8e7063ec8338c268b/activeresource/lib/active_resource/base.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/base.rb?ref=1b42dbd8a94bf653d0a513e8e7063ec8338c268b",
patch = "@@ -1028,19 +1028,20 @@ def load(attributes)\n @attributes[key.to_s] =\n case value\n when Array\n- resource = find_or_create_resource_for_collection(key)\n+ resource = nil\n value.map do |attrs|\n- if attrs.is_a?(String) || attrs.is_a?(Numeric)\n- attrs.duplicable? ? attrs.dup : attrs\n- else\n+ if attrs.is_a?(Hash)\n+ resource ||= find_or_create_resource_for_collection(key)\n resource.new(attrs)\n+ else\n+ attrs.duplicable? ? attrs.dup : attrs\n end\n end\n when Hash\n resource = find_or_create_resource_for(key)\n resource.new(value)\n else\n- value.dup rescue value\n+ value.duplicable? ? value.dup : value\n end\n end\n self\n@@ -1113,34 +1114,44 @@ def find_or_create_resource_for_collection(name)\n end\n \n # Tries to find a resource in a non empty list of nested modules\n- # Raises a NameError if it was not found in any of the given nested modules\n- def find_resource_in_modules(resource_name, module_names)\n+ # if it fails, then the resource is created\n+ def find_or_create_resource_in_modules(resource_name, module_names)\n receiver = Object\n namespaces = module_names[0, module_names.size-1].map do |module_name|\n receiver = receiver.const_get(module_name)\n end\n- if namespace = namespaces.reverse.detect { |ns| ns.const_defined?(resource_name) }\n- return namespace.const_get(resource_name)\n+ const_args = RUBY_VERSION < \"1.9\" ? [resource_name] : [resource_name, false]\n+ if namespace = namespaces.reverse.detect { |ns| ns.const_defined?(*const_args) }\n+ namespace.const_get(*const_args)\n else\n- raise NameError\n+ create_resource_for(resource_name)\n end\n end\n \n # Tries to find a resource for a given name; if it fails, then the resource is created\n def find_or_create_resource_for(name)\n resource_name = name.to_s.camelize\n- ancestors = self.class.name.split(\"::\")\n- if ancestors.size > 1\n- find_resource_in_modules(resource_name, ancestors)\n- else\n- self.class.const_get(resource_name)\n- end\n- rescue NameError\n- if self.class.const_defined?(resource_name)\n- resource = self.class.const_get(resource_name)\n+\n+ const_args = RUBY_VERSION < \"1.9\" ? [resource_name] : [resource_name, false]\n+ if self.class.const_defined?(*const_args)\n+ self.class.const_get(*const_args)\n else\n- resource = self.class.const_set(resource_name, Class.new(ActiveResource::Base))\n+ ancestors = self.class.name.split(\"::\")\n+ if ancestors.size > 1\n+ find_or_create_resource_in_modules(resource_name, ancestors)\n+ else\n+ if Object.const_defined?(*const_args)\n+ Object.const_get(*const_args)\n+ else\n+ create_resource_for(resource_name)\n+ end\n+ end\n end\n+ end\n+\n+ # Create and return a class definition for a resource inside the current resource\n+ def create_resource_for(resource_name)\n+ resource = self.class.const_set(resource_name, Class.new(ActiveResource::Base))\n resource.prefix = self.class.prefix\n resource.site = self.class.site\n resource"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:56 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4607", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 17:47:28 GMT",
etag = "\"28ab6affe1d8d12548ef3aab09aec0cb\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248929:54D90244",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "a30e6f9aa7cf5731b87dfb3b9992202d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = FALSE, content = structure(list(
message = "Not Found", documentation_url = "https://developer.github.com/v3"), .Names = c("message",
"documentation_url")), headers = structure(list(server = "GitHub.com",
date = "Mon, 09 Feb 2015 18:53:57 GMT", `content-type` = "application/json; charset=utf-8",
`transfer-encoding` = "chunked", status = "404 Not Found",
`x-ratelimit-limit` = "5000", `x-ratelimit-remaining` = "4606",
`x-ratelimit-reset` = "1423510857", `x-oauth-scopes` = "",
`x-accepted-oauth-scopes` = "", `x-oauth-client-id` = "3f2c05f63b3d9cebf87f",
`x-github-media-type` = "github.v3", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248944:54D90244",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", `content-encoding` = "gzip"), .Names = c("server",
"date", "content-type", "transfer-encoding", "status", "x-ratelimit-limit",
"x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes",
"x-accepted-oauth-scopes", "x-oauth-client-id", "x-github-media-type",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "content-encoding"), class = c("insensitive",
"list")), code = 404L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = FALSE, content = structure(list(
message = "Not Found", documentation_url = "https://developer.github.com/v3"), .Names = c("message",
"documentation_url")), headers = structure(list(server = "GitHub.com",
date = "Mon, 09 Feb 2015 18:53:57 GMT", `content-type` = "application/json; charset=utf-8",
`transfer-encoding` = "chunked", status = "404 Not Found",
`x-ratelimit-limit` = "5000", `x-ratelimit-remaining` = "4605",
`x-ratelimit-reset` = "1423510857", `x-oauth-scopes` = "",
`x-accepted-oauth-scopes` = "", `x-oauth-client-id` = "3f2c05f63b3d9cebf87f",
`x-github-media-type` = "github.v3", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248962:54D90245",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", `content-encoding` = "gzip"), .Names = c("server",
"date", "content-type", "transfer-encoding", "status", "x-ratelimit-limit",
"x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes",
"x-accepted-oauth-scopes", "x-oauth-client-id", "x-github-media-type",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "content-encoding"), class = c("insensitive",
"list")), code = 404L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = FALSE, content = structure(list(
message = "Not Found", documentation_url = "https://developer.github.com/v3"), .Names = c("message",
"documentation_url")), headers = structure(list(server = "GitHub.com",
date = "Mon, 09 Feb 2015 18:53:57 GMT", `content-type` = "application/json; charset=utf-8",
`transfer-encoding` = "chunked", status = "404 Not Found",
`x-ratelimit-limit` = "5000", `x-ratelimit-remaining` = "4604",
`x-ratelimit-reset` = "1423510857", `x-oauth-scopes` = "",
`x-accepted-oauth-scopes` = "", `x-oauth-client-id` = "3f2c05f63b3d9cebf87f",
`x-github-media-type` = "github.v3", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248977:54D90245",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", `content-encoding` = "gzip"), .Names = c("server",
"date", "content-type", "transfer-encoding", "status", "x-ratelimit-limit",
"x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes",
"x-accepted-oauth-scopes", "x-oauth-client-id", "x-github-media-type",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "content-encoding"), class = c("insensitive",
"list")), code = 404L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "32ffbee7a112f5ddfce3a3beb272136989dbb09e", filename = "railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/a9fb5116d7f9016e870343320c8e2b3a3cbd4064/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt",
raw_url = "https://github.com/rails/rails/raw/a9fb5116d7f9016e870343320c8e2b3a3cbd4064/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt?ref=a9fb5116d7f9016e870343320c8e2b3a3cbd4064",
patch = "@@ -3,7 +3,7 @@\n # This file contains the settings for ActionController::ParametersWrapper\n # which will be enabled by default in the upcoming version of Ruby on Rails.\n \n-# Enable parameter wrapping for JSON. You can disable this by set :format to empty array.\n+# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.\n ActionController::Base.wrap_parameters :format => [:json]\n \n # Disable root element in JSON by default."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:57 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4604", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 06:34:55 GMT",
etag = "\"f8a3e98aa66daf60e55bb79957b09861\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248999:54D90245",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "8dd185e423974a7e13abbbe6e060031e"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "a0c953967c072fe900f5af8cbb2ae68319a07b32", filename = "railties/lib/rails/tasks/routes.rake",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/97f9000cf2c4cfad91b074c8fd08aee2ea954ee5/railties/lib/rails/tasks/routes.rake",
raw_url = "https://github.com/rails/rails/raw/97f9000cf2c4cfad91b074c8fd08aee2ea954ee5/railties/lib/rails/tasks/routes.rake",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/tasks/routes.rake?ref=97f9000cf2c4cfad91b074c8fd08aee2ea954ee5",
patch = "@@ -17,7 +17,7 @@ task :routes => :environment do\n end\n \n # Skip the route if it's internal info route\n- routes.reject! { |r| r[:path] =~ %r{/rails/info/properties|/assets} }\n+ routes.reject! { |r| r[:path] =~ %r{/rails/info/properties|^/assets} }\n \n name_width = routes.map{ |r| r[:name].length }.max\n verb_width = routes.map{ |r| r[:verb].length }.max"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "a8bcf7beaf12268a623659ca436ea30e86dd0dbc",
filename = "railties/test/application/rake_test.rb", status = "modified",
additions = 9L, deletions = 0L, changes = 9L, blob_url = "https://github.com/rails/rails/blob/97f9000cf2c4cfad91b074c8fd08aee2ea954ee5/railties/test/application/rake_test.rb",
raw_url = "https://github.com/rails/rails/raw/97f9000cf2c4cfad91b074c8fd08aee2ea954ee5/railties/test/application/rake_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/application/rake_test.rb?ref=97f9000cf2c4cfad91b074c8fd08aee2ea954ee5",
patch = "@@ -64,6 +64,15 @@ def test_rake_routes_output_strips_anchors_from_http_verbs\n assert_match 'cart GET /cart(.:format)', Dir.chdir(app_path){ `rake routes` }\n end\n \n+ def test_rake_routes_shows_custom_assets\n+ app_file \"config/routes.rb\", <<-RUBY\n+ AppTemplate::Application.routes.draw do\n+ get '/custom/assets', :to => 'custom_assets#show'\n+ end\n+ RUBY\n+ assert_match 'custom_assets GET /custom/assets(.:format)', Dir.chdir(app_path){ `rake routes` }\n+ end\n+\n def test_model_and_migration_generator_with_change_syntax\n Dir.chdir(app_path) do\n `rails generate model user username:string password:string`"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:57 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4604", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 16:11:22 GMT",
etag = "\"8b6c7af47657cf4248bb2ca0923910f2\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2489AD:54D90245",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "4c8b2d4732c413f4b9aefe394bd65569"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = FALSE, content = structure(list(
message = "Not Found", documentation_url = "https://developer.github.com/v3"), .Names = c("message",
"documentation_url")), headers = structure(list(server = "GitHub.com",
date = "Mon, 09 Feb 2015 18:53:57 GMT", `content-type` = "application/json; charset=utf-8",
`transfer-encoding` = "chunked", status = "404 Not Found",
`x-ratelimit-limit` = "5000", `x-ratelimit-remaining` = "4603",
`x-ratelimit-reset` = "1423510857", `x-oauth-scopes` = "",
`x-accepted-oauth-scopes` = "", `x-oauth-client-id` = "3f2c05f63b3d9cebf87f",
`x-github-media-type` = "github.v3", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2489C3:54D90245",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", `content-encoding` = "gzip"), .Names = c("server",
"date", "content-type", "transfer-encoding", "status", "x-ratelimit-limit",
"x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes",
"x-accepted-oauth-scopes", "x-oauth-client-id", "x-github-media-type",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "content-encoding"), class = c("insensitive",
"list")), code = 404L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "26103cddb7122bbecb777c872501bbdf46e0b3e3", filename = "actionpack/lib/action_controller/metal/http_authentication.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_controller/metal/http_authentication.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_controller/metal/http_authentication.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_controller/metal/http_authentication.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -276,7 +276,7 @@ def secret_token(request)\n #\n # An implementation might choose not to accept a previously used nonce or a previously used digest, in order to\n # protect against a replay attack. Or, an implementation might choose to use one-time nonces or digests for\n- # POST or PUT requests and a time-stamp for GET requests. For more details on the issues involved see Section 4\n+ # POST, PUT, or PATCH requests and a time-stamp for GET requests. For more details on the issues involved see Section 4\n # of this document.\n #\n # The nonce is opaque to the client. Composed of Time, and hash of Time with secret\n@@ -290,7 +290,7 @@ def nonce(secret_key, time = Time.now)\n end\n \n # Might want a shorter timeout depending on whether the request\n- # is a PUT or POST, and if client is browser or web service.\n+ # is a PATCH, PUT, or POST, and if client is browser or web service.\n # Can be much shorter if the Stale directive is implemented. This would\n # allow a user to use new nonce without prompting user again for their\n # username and password."), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "035beabd72c333d1bfcd08f42a555ceffb078eef",
filename = "actionpack/lib/action_controller/metal/responder.rb",
status = "modified", additions = 3L, deletions = 2L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_controller/metal/responder.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_controller/metal/responder.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_controller/metal/responder.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -53,7 +53,7 @@ module ActionController #:nodoc:\n # end\n # end\n #\n- # The same happens for PUT and DELETE requests.\n+ # The same happens for PATCH and DELETE requests.\n #\n # === Nested resources\n #\n@@ -118,6 +118,7 @@ class Responder\n \n ACTIONS_FOR_VERBS = {\n :post => :new,\n+ :patch => :edit,\n :put => :edit\n }\n \n@@ -133,7 +134,7 @@ def initialize(controller, resources, options={})\n end\n \n delegate :head, :render, :redirect_to, :to => :controller\n- delegate :get?, :post?, :put?, :delete?, :to => :request\n+ delegate :get?, :post?, :patch?, :put?, :delete?, :to => :request\n \n # Undefine :to_json and :to_yaml since it's defined on Object\n undef_method(:to_json) if method_defined?(:to_json)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "870fbe712941d98cb1845de10731afe51962a273",
filename = "actionpack/lib/action_controller/test_case.rb",
status = "modified", additions = 6L, deletions = 1L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_controller/test_case.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_controller/test_case.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_controller/test_case.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -224,7 +224,7 @@ def exists?\n # == Basic example\n #\n # Functional tests are written as follows:\n- # 1. First, one uses the +get+, +post+, +put+, +delete+ or +head+ method to simulate\n+ # 1. First, one uses the +get+, +post+, +patch+, +put+, +delete+ or +head+ method to simulate\n # an HTTP request.\n # 2. Then, one asserts whether the current state is as expected. \"State\" can be anything:\n # the controller's HTTP response, the database contents, etc.\n@@ -369,6 +369,11 @@ def post(action, parameters = nil, session = nil, flash = nil)\n process(action, parameters, session, flash, \"POST\")\n end\n \n+ # Executes a request simulating PATCH HTTP method and set/volley the response\n+ def patch(action, parameters = nil, session = nil, flash = nil)\n+ process(action, parameters, session, flash, \"PATCH\")\n+ end\n+\n # Executes a request simulating PUT HTTP method and set/volley the response\n def put(action, parameters = nil, session = nil, flash = nil)\n process(action, parameters, session, flash, \"PUT\")"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "771be28eebf50bee54850ccb61da5d17ae9ccdda",
filename = "actionpack/lib/action_dispatch/http/request.rb",
status = "modified", additions = 6L, deletions = 0L, changes = 6L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_dispatch/http/request.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_dispatch/http/request.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_dispatch/http/request.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -105,6 +105,12 @@ def post?\n HTTP_METHOD_LOOKUP[request_method] == :post\n end\n \n+ # Is this a PATCH request?\n+ # Equivalent to <tt>request.request_method == :patch</tt>.\n+ def patch?\n+ HTTP_METHOD_LOOKUP[request_method] == :patch\n+ end\n+\n # Is this a PUT request?\n # Equivalent to <tt>request.request_method == :put</tt>.\n def put?"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "7ed6f33f10e7978bfac780aab3b5cb4ea4ecf674",
filename = "actionpack/lib/action_dispatch/routing.rb", status = "modified",
additions = 9L, deletions = 6L, changes = 15L, blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_dispatch/routing.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_dispatch/routing.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_dispatch/routing.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -182,10 +182,13 @@ module ActionDispatch\n #\n # == HTTP Methods\n #\n- # Using the <tt>:via</tt> option when specifying a route allows you to restrict it to a specific HTTP method.\n- # Possible values are <tt>:post</tt>, <tt>:get</tt>, <tt>:put</tt>, <tt>:delete</tt> and <tt>:any</tt>.\n- # If your route needs to respond to more than one method you can use an array, e.g. <tt>[ :get, :post ]</tt>.\n- # The default value is <tt>:any</tt> which means that the route will respond to any of the HTTP methods.\n+ # Using the <tt>:via</tt> option when specifying a route allows you to\n+ # restrict it to a specific HTTP method. Possible values are <tt>:post</tt>,\n+ # <tt>:get</tt>, <tt>:patch</tt>, <tt>:put</tt>, <tt>:delete</tt> and\n+ # <tt>:any</tt>. If your route needs to respond to more than one method you\n+ # can use an array, e.g. <tt>[ :get, :post ]</tt>. The default value is\n+ # <tt>:any</tt> which means that the route will respond to any of the HTTP\n+ # methods.\n #\n # Examples:\n #\n@@ -198,7 +201,7 @@ module ActionDispatch\n # === HTTP helper methods\n #\n # An alternative method of specifying which HTTP method a route should respond to is to use the helper\n- # methods <tt>get</tt>, <tt>post</tt>, <tt>put</tt> and <tt>delete</tt>.\n+ # methods <tt>get</tt>, <tt>post</tt>, <tt>patch</tt>, <tt>put</tt> and <tt>delete</tt>.\n #\n # Examples:\n #\n@@ -284,7 +287,7 @@ module Routing\n autoload :PolymorphicRoutes, 'action_dispatch/routing/polymorphic_routes'\n \n SEPARATORS = %w( / . ? ) #:nodoc:\n- HTTP_METHODS = [:get, :head, :post, :put, :delete, :options] #:nodoc:\n+ HTTP_METHODS = [:get, :head, :post, :patch, :put, :delete, :options] #:nodoc:\n \n # A helper module to hold URL related helpers.\n module Helpers #:nodoc:"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "1644eb772b7f37100b2dda3fb2c5fffc6a49b7c3",
filename = "actionpack/lib/action_dispatch/routing/mapper.rb",
status = "modified", additions = 24L, deletions = 3L, changes = 27L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_dispatch/routing/mapper.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_dispatch/routing/mapper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_dispatch/routing/mapper.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -484,6 +484,16 @@ def post(*args, &block)\n map_method(:post, *args, &block)\n end\n \n+ # Define a route that only recognizes HTTP PATCH.\n+ # For supported arguments, see <tt>Base#match</tt>.\n+ #\n+ # Example:\n+ #\n+ # patch 'bacon', :to => 'food#bacon'\n+ def patch(*args, &block)\n+ map_method(:patch, *args, &block)\n+ end\n+\n # Define a route that only recognizes HTTP PUT.\n # For supported arguments, see <tt>Base#match</tt>.\n #\n@@ -494,7 +504,7 @@ def put(*args, &block)\n map_method(:put, *args, &block)\n end\n \n- # Define a route that only recognizes HTTP PUT.\n+ # Define a route that only recognizes HTTP DELETE.\n # For supported arguments, see <tt>Base#match</tt>.\n #\n # Example:\n@@ -532,6 +542,7 @@ def map_method(method, *args, &block)\n # POST\t /admin/posts\n # GET\t /admin/posts/1\n # GET\t /admin/posts/1/edit\n+ # PATCH\t /admin/posts/1\n # PUT\t /admin/posts/1\n # DELETE /admin/posts/1\n #\n@@ -566,6 +577,7 @@ def map_method(method, *args, &block)\n # POST\t /admin/posts\n # GET\t /admin/posts/1\n # GET\t /admin/posts/1/edit\n+ # PATCH\t /admin/posts/1\n # PUT\t /admin/posts/1\n # DELETE /admin/posts/1\n module Scoping\n@@ -661,6 +673,7 @@ def controller(controller, options={})\n # new_admin_post GET /admin/posts/new(.:format) {:action=>\"new\", :controller=>\"admin/posts\"}\n # edit_admin_post GET /admin/posts/:id/edit(.:format) {:action=>\"edit\", :controller=>\"admin/posts\"}\n # admin_post GET /admin/posts/:id(.:format) {:action=>\"show\", :controller=>\"admin/posts\"}\n+ # admin_post PATCH /admin/posts/:id(.:format) {:action=>\"update\", :controller=>\"admin/posts\"}\n # admin_post PUT /admin/posts/:id(.:format) {:action=>\"update\", :controller=>\"admin/posts\"}\n # admin_post DELETE /admin/posts/:id(.:format) {:action=>\"destroy\", :controller=>\"admin/posts\"}\n #\n@@ -974,7 +987,7 @@ def resources_path_names(options)\n #\n # resource :geocoder\n #\n- # creates six different routes in your application, all mapping to\n+ # creates seven different routes in your application, all mapping to\n # the GeoCoders controller (note that the controller is named after\n # the plural):\n #\n@@ -982,6 +995,7 @@ def resources_path_names(options)\n # POST /geocoder\n # GET /geocoder\n # GET /geocoder/edit\n+ # PATCH /geocoder\n # PUT /geocoder\n # DELETE /geocoder\n #\n@@ -1008,6 +1022,7 @@ def resource(*resources, &block)\n member do\n get :edit if parent_resource.actions.include?(:edit)\n get :show if parent_resource.actions.include?(:show)\n+ patch :update if parent_resource.actions.include?(:update)\n put :update if parent_resource.actions.include?(:update)\n delete :destroy if parent_resource.actions.include?(:destroy)\n end\n@@ -1023,13 +1038,15 @@ def resource(*resources, &block)\n #\n # resources :photos\n #\n- # creates seven different routes in your application, all mapping to\n+ # creates eight different routes in your application, all mapping to\n # the Photos controller:\n #\n+ # GET /photos\n # GET /photos/new\n # POST /photos\n # GET /photos/:id\n # GET /photos/:id/edit\n+ # PATCH /photos/:id\n # PUT /photos/:id\n # DELETE /photos/:id\n #\n@@ -1041,10 +1058,12 @@ def resource(*resources, &block)\n #\n # This generates the following comments routes:\n #\n+ # GET /photos/:id/comments\n # GET /photos/:id/comments/new\n # POST /photos/:id/comments\n # GET /photos/:id/comments/:id\n # GET /photos/:id/comments/:id/edit\n+ # PATCH /photos/:id/comments/:id\n # PUT /photos/:id/comments/:id\n # DELETE /photos/:id/comments/:id\n #\n@@ -1102,6 +1121,7 @@ def resource(*resources, &block)\n # new_post_comment GET /sekret/posts/:post_id/comments/new(.:format)\n # edit_comment GET /sekret/comments/:id/edit(.:format)\n # comment GET /sekret/comments/:id(.:format)\n+ # comment PATCH /sekret/comments/:id(.:format)\n # comment PUT /sekret/comments/:id(.:format)\n # comment DELETE /sekret/comments/:id(.:format)\n #\n@@ -1134,6 +1154,7 @@ def resources(*resources, &block)\n member do\n get :edit if parent_resource.actions.include?(:edit)\n get :show if parent_resource.actions.include?(:show)\n+ patch :update if parent_resource.actions.include?(:update)\n put :update if parent_resource.actions.include?(:update)\n delete :destroy if parent_resource.actions.include?(:destroy)\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "10f2638a2fab2b4230ff8c5a1d7fdfa337f9ea9c",
filename = "actionpack/lib/action_dispatch/testing/integration.rb",
status = "modified", additions = 19L, deletions = 7L, changes = 26L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_dispatch/testing/integration.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_dispatch/testing/integration.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_dispatch/testing/integration.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -27,8 +27,8 @@ module RequestHelpers\n # object's <tt>@response</tt> instance variable will point to the same\n # response object.\n #\n- # You can also perform POST, PUT, DELETE, and HEAD requests with +#post+,\n- # +#put+, +#delete+, and +#head+.\n+ # You can also perform POST, PATCH, PUT, DELETE, and HEAD requests with\n+ # +#post+, +#patch+, +#put+, +#delete+, and +#head+.\n def get(path, parameters = nil, headers = nil)\n process :get, path, parameters, headers\n end\n@@ -39,6 +39,12 @@ def post(path, parameters = nil, headers = nil)\n process :post, path, parameters, headers\n end\n \n+ # Performs a PATCH request with the given parameters. See +#get+ for more\n+ # details.\n+ def patch(path, parameters = nil, headers = nil)\n+ process :patch, path, parameters, headers\n+ end\n+\n # Performs a PUT request with the given parameters. See +#get+ for more\n # details.\n def put(path, parameters = nil, headers = nil)\n@@ -60,10 +66,10 @@ def head(path, parameters = nil, headers = nil)\n # Performs an XMLHttpRequest request with the given parameters, mirroring\n # a request from the Prototype library.\n #\n- # The request_method is +:get+, +:post+, +:put+, +:delete+ or +:head+; the\n- # parameters are +nil+, a hash, or a url-encoded or multipart string;\n- # the headers are a hash. Keys are automatically upcased and prefixed\n- # with 'HTTP_' if not already.\n+ # The request_method is +:get+, +:post+, +#patch+, +:put+, +:delete+ or\n+ # +:head+; the parameters are +nil+, a hash, or a url-encoded or multipart\n+ # string; the headers are a hash. Keys are automatically upcased and\n+ # prefixed with 'HTTP_' if not already.\n def xml_http_request(request_method, path, parameters = nil, headers = nil)\n headers ||= {}\n headers['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'\n@@ -103,6 +109,12 @@ def post_via_redirect(path, parameters = nil, headers = nil)\n request_via_redirect(:post, path, parameters, headers)\n end\n \n+ # Performs a PATCH request, following any subsequent redirect.\n+ # See +request_via_redirect+ for more information.\n+ def patch_via_redirect(path, parameters = nil, headers = nil)\n+ request_via_redirect(:patch, path, parameters, headers)\n+ end\n+\n # Performs a PUT request, following any subsequent redirect.\n # See +request_via_redirect+ for more information.\n def put_via_redirect(path, parameters = nil, headers = nil)\n@@ -316,7 +328,7 @@ def reset!\n @integration_session = Integration::Session.new(app)\n end\n \n- %w(get post put head delete cookies assigns\n+ %w(get post patch put head delete cookies assigns\n xml_http_request xhr get_via_redirect post_via_redirect).each do |method|\n define_method(method) do |*args|\n reset! unless integration_session"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "55564def91dea8bf6654eabbb5c0282405744124",
filename = "actionpack/lib/action_view/helpers/form_helper.rb",
status = "modified", additions = 4L, deletions = 4L, changes = 8L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_view/helpers/form_helper.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_view/helpers/form_helper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_view/helpers/form_helper.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -190,7 +190,7 @@ def convert_to_model(object)\n #\n # is equivalent to something like:\n #\n- # <%= form_for @post, :as => :post, :url => post_path(@post), :method => :put, :html => { :class => \"edit_post\", :id => \"edit_post_45\" } do |f| %>\n+ # <%= form_for @post, :as => :post, :url => post_path(@post), :method => :patch, :html => { :class => \"edit_post\", :id => \"edit_post_45\" } do |f| %>\n # ...\n # <% end %>\n #\n@@ -245,7 +245,7 @@ def convert_to_model(object)\n #\n # You can force the form to use the full array of HTTP verbs by setting \n #\n- # :method => (:get|:post|:put|:delete)\n+ # :method => (:get|:post|:patch|:put|:delete)\n #\n # in the options hash. If the verb is not GET or POST, which are natively supported by HTML forms, the\n # form will be set to POST and a hidden input called _method will carry the intended verb for the server\n@@ -273,7 +273,7 @@ def convert_to_model(object)\n #\n # <form action='http://www.example.com' method='post' data-remote='true'>\n # <div style='margin:0;padding:0;display:inline'>\n- # <input name='_method' type='hidden' value='put' />\n+ # <input name='_method' type='hidden' value='patch' />\n # </div>\n # ...\n # </form>\n@@ -381,7 +381,7 @@ def apply_form_for_options!(object_or_array, options) #:nodoc:\n object = convert_to_model(object)\n \n as = options[:as]\n- action, method = object.respond_to?(:persisted?) && object.persisted? ? [:edit, :put] : [:new, :post]\n+ action, method = object.respond_to?(:persisted?) && object.persisted? ? [:edit, :patch] : [:new, :post]\n options[:html].reverse_merge!(\n :class => as ? \"#{as}_#{action}\" : dom_class(object, action),\n :id => as ? \"#{as}_#{action}\" : dom_id(object, action),"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "884fc946fadced488b18cf08afcb0fd7285badbb",
filename = "actionpack/lib/action_view/helpers/form_tag_helper.rb",
status = "modified", additions = 3L, deletions = 3L, changes = 6L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_view/helpers/form_tag_helper.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_view/helpers/form_tag_helper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_view/helpers/form_tag_helper.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -23,7 +23,7 @@ module FormTagHelper\n # ==== Options\n # * <tt>:multipart</tt> - If set to true, the enctype is set to \"multipart/form-data\".\n # * <tt>:method</tt> - The method to use when submitting the form, usually either \"get\" or \"post\".\n- # If \"put\", \"delete\", or another verb is used, a hidden input with name <tt>_method</tt>\n+ # If \"patch\", \"delete\", or another verb is used, a hidden input with name <tt>_method</tt>\n # is added to simulate the verb over post.\n # * <tt>:authenticity_token</tt> - Authenticity token to use in the form. Use only if you need to\n # pass custom authenticity token string, or to not add authenticity_token field at all\n@@ -36,8 +36,8 @@ module FormTagHelper\n # form_tag('/posts')\n # # => <form action=\"/posts\" method=\"post\">\n #\n- # form_tag('/posts/1', :method => :put)\n- # # => <form action=\"/posts/1\" method=\"put\">\n+ # form_tag('/posts/1', :method => :patch)\n+ # # => <form action=\"/posts/1\" method=\"patch\">\n #\n # form_tag('/upload', :multipart => true)\n # # => <form action=\"/upload\" method=\"post\" enctype=\"multipart/form-data\">"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "61e7a0419dc2a094b8fb4726327eab0f8379c63e",
filename = "actionpack/lib/action_view/helpers/url_helper.rb",
status = "modified", additions = 4L, deletions = 4L, changes = 8L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_view/helpers/url_helper.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/lib/action_view/helpers/url_helper.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_view/helpers/url_helper.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -146,12 +146,12 @@ def url_for(options = {})\n # create an HTML form and immediately submit the form for processing using\n # the HTTP verb specified. Useful for having links perform a POST operation\n # in dangerous actions like deleting a record (which search bots can follow\n- # while spidering your site). Supported verbs are <tt>:post</tt>, <tt>:delete</tt> and <tt>:put</tt>.\n+ # while spidering your site). Supported verbs are <tt>:post</tt>, <tt>:delete</tt>, <tt>:patch</tt>, and <tt>:put</tt>.\n # Note that if the user has JavaScript disabled, the request will fall back\n # to using GET. If <tt>:href => '#'</tt> is used and the user has JavaScript\n # disabled clicking the link will have no effect. If you are relying on the\n # POST behavior, you should check for it in your controller's action by using\n- # the request object's methods for <tt>post?</tt>, <tt>delete?</tt> or <tt>put?</tt>.\n+ # the request object's methods for <tt>post?</tt>, <tt>delete?</tt>, <tt>:patch</tt>, or <tt>put?</tt>.\n # * <tt>:remote => true</tt> - This will allow the unobtrusive JavaScript\n # driver to make an Ajax request to the URL in question instead of following\n # the link. The drivers each provide mechanisms for listening for the\n@@ -272,7 +272,7 @@ def link_to(*args, &block)\n #\n # There are a few special +html_options+:\n # * <tt>:method</tt> - Symbol of HTTP verb. Supported verbs are <tt>:post</tt>, <tt>:get</tt>,\n- # <tt>:delete</tt> and <tt>:put</tt>. By default it will be <tt>:post</tt>.\n+ # <tt>:delete</tt>, <tt>:patch</tt>, and <tt>:put</tt>. By default it will be <tt>:post</tt>.\n # * <tt>:disabled</tt> - If set to true, it will generate a disabled button.\n # * <tt>:confirm</tt> - This will use the unobtrusive JavaScript driver to\n # prompt with the question specified. If the user accepts, the link is\n@@ -319,7 +319,7 @@ def button_to(name, options = {}, html_options = {})\n convert_boolean_attributes!(html_options, %w( disabled ))\n \n method_tag = ''\n- if (method = html_options.delete('method')) && %w{put delete}.include?(method.to_s)\n+ if (method = html_options.delete('method')) && %w{patch put delete}.include?(method.to_s)\n method_tag = tag('input', :type => 'hidden', :name => '_method', :value => method.to_s)\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "a3a724afa563673dccffc02c97d089191835964e",
filename = "actionpack/test/controller/caching_test.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/controller/caching_test.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/controller/caching_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/controller/caching_test.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -140,7 +140,7 @@ def test_should_cache_ok_at_custom_path\n end\n \n [:ok, :no_content, :found, :not_found].each do |status|\n- [:get, :post, :put, :delete].each do |method|\n+ [:get, :post, :patch, :put, :delete].each do |method|\n unless method == :get and status == :ok\n define_method \"test_shouldnt_cache_#{method}_with_#{status}_status\" do\n send(method, status)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c66681a539b09b1f420888f161d84dd35115bd0d",
filename = "actionpack/test/controller/integration_test.rb",
status = "modified", additions = 23L, deletions = 1L, changes = 24L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/controller/integration_test.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/controller/integration_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/controller/integration_test.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -63,6 +63,12 @@ def test_post_via_redirect\n @session.post_via_redirect(path, args, headers)\n end\n \n+ def test_patch_via_redirect\n+ path = \"/somepath\"; args = {:id => '1'}; headers = {\"X-Test-Header\" => \"testvalue\" }\n+ @session.expects(:request_via_redirect).with(:patch, path, args, headers)\n+ @session.patch_via_redirect(path, args, headers)\n+ end\n+\n def test_put_via_redirect\n path = \"/somepath\"; args = {:id => '1'}; headers = {\"X-Test-Header\" => \"testvalue\" }\n @session.expects(:request_via_redirect).with(:put, path, args, headers)\n@@ -87,6 +93,12 @@ def test_post\n @session.post(path,params,headers)\n end\n \n+ def test_patch\n+ path = \"/index\"; params = \"blah\"; headers = {:location => 'blah'}\n+ @session.expects(:process).with(:patch,path,params,headers)\n+ @session.patch(path,params,headers)\n+ end\n+\n def test_put\n path = \"/index\"; params = \"blah\"; headers = {:location => 'blah'}\n @session.expects(:process).with(:put,path,params,headers)\n@@ -125,6 +137,16 @@ def test_xml_http_request_post\n @session.xml_http_request(:post,path,params,headers)\n end\n \n+ def test_xml_http_request_patch\n+ path = \"/index\"; params = \"blah\"; headers = {:location => 'blah'}\n+ headers_after_xhr = headers.merge(\n+ \"HTTP_X_REQUESTED_WITH\" => \"XMLHttpRequest\",\n+ \"HTTP_ACCEPT\" => \"text/javascript, text/html, application/xml, text/xml, */*\"\n+ )\n+ @session.expects(:process).with(:patch,path,params,headers_after_xhr)\n+ @session.xml_http_request(:patch,path,params,headers)\n+ end\n+\n def test_xml_http_request_put\n path = \"/index\"; params = \"blah\"; headers = {:location => 'blah'}\n headers_after_xhr = headers.merge(\n@@ -212,7 +234,7 @@ def test_integration_methods_called\n @integration_session.stubs(:generic_url_rewriter)\n @integration_session.stubs(:process)\n \n- %w( get post head put delete ).each do |verb|\n+ %w( get post head patch put delete ).each do |verb|\n assert_nothing_raised(\"'#{verb}' should use integration test methods\") { __send__(verb, '/') }\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "54e05d5e91312472010a6038db0744fb6ca3109b",
filename = "actionpack/test/controller/mime_responds_test.rb",
status = "modified", additions = 64L, deletions = 0L, changes = 64L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/controller/mime_responds_test.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/controller/mime_responds_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/controller/mime_responds_test.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -723,6 +723,69 @@ def test_using_resource_for_post_with_xml_yields_unprocessable_entity_on_failure\n end\n end\n \n+ def test_using_resource_for_patch_with_html_redirects_on_success\n+ with_test_route_set do\n+ patch :using_resource\n+ assert_equal \"text/html\", @response.content_type\n+ assert_equal 302, @response.status\n+ assert_equal \"http://www.example.com/customers/13\", @response.location\n+ assert @response.redirect?\n+ end\n+ end\n+\n+ def test_using_resource_for_patch_with_html_rerender_on_failure\n+ with_test_route_set do\n+ errors = { :name => :invalid }\n+ Customer.any_instance.stubs(:errors).returns(errors)\n+ patch :using_resource\n+ assert_equal \"text/html\", @response.content_type\n+ assert_equal 200, @response.status\n+ assert_equal \"Edit world!\\n\", @response.body\n+ assert_nil @response.location\n+ end\n+ end\n+\n+ def test_using_resource_for_patch_with_html_rerender_on_failure_even_on_method_override\n+ with_test_route_set do\n+ errors = { :name => :invalid }\n+ Customer.any_instance.stubs(:errors).returns(errors)\n+ @request.env[\"rack.methodoverride.original_method\"] = \"POST\"\n+ patch :using_resource\n+ assert_equal \"text/html\", @response.content_type\n+ assert_equal 200, @response.status\n+ assert_equal \"Edit world!\\n\", @response.body\n+ assert_nil @response.location\n+ end\n+ end\n+\n+ def test_using_resource_for_patch_with_xml_yields_ok_on_success\n+ @request.accept = \"application/xml\"\n+ patch :using_resource\n+ assert_equal \"application/xml\", @response.content_type\n+ assert_equal 200, @response.status\n+ assert_equal \" \", @response.body\n+ end\n+\n+ def test_using_resource_for_patch_with_json_yields_ok_on_success\n+ Customer.any_instance.stubs(:to_json).returns('{\"name\": \"David\"}')\n+ @request.accept = \"application/json\"\n+ patch :using_resource\n+ assert_equal \"application/json\", @response.content_type\n+ assert_equal 200, @response.status\n+ assert_equal \"{}\", @response.body\n+ end\n+\n+ def test_using_resource_for_patch_with_xml_yields_unprocessable_entity_on_failure\n+ @request.accept = \"application/xml\"\n+ errors = { :name => :invalid }\n+ Customer.any_instance.stubs(:errors).returns(errors)\n+ patch :using_resource\n+ assert_equal \"application/xml\", @response.content_type\n+ assert_equal 422, @response.status\n+ assert_equal errors.to_xml, @response.body\n+ assert_nil @response.location\n+ end\n+\n def test_using_resource_for_put_with_html_redirects_on_success\n with_test_route_set do\n put :using_resource\n@@ -786,6 +849,7 @@ def test_using_resource_for_put_with_xml_yields_unprocessable_entity_on_failure\n assert_nil @response.location\n end\n \n+\n def test_using_resource_for_delete_with_html_redirects_on_success\n with_test_route_set do\n Customer.any_instance.stubs(:destroyed?).returns(true)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c9906a3768257dba8fb9d8455ca5f848b0f23739",
filename = "actionpack/test/controller/request_forgery_protection_test.rb",
status = "modified", additions = 14L, deletions = 1L, changes = 15L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/controller/request_forgery_protection_test.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/controller/request_forgery_protection_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/controller/request_forgery_protection_test.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -115,6 +115,10 @@ def test_should_not_allow_post_without_token_irrespective_of_format\n assert_blocked { post :index, :format=>'xml' }\n end\n \n+ def test_should_not_allow_patch_without_token\n+ assert_blocked { patch :index }\n+ end\n+\n def test_should_not_allow_put_without_token\n assert_blocked { put :index }\n end\n@@ -131,6 +135,10 @@ def test_should_allow_post_with_token\n assert_not_blocked { post :index, :authenticity_token => @token }\n end\n \n+ def test_should_allow_patch_with_token\n+ assert_not_blocked { patch :index, :authenticity_token => @token }\n+ end\n+\n def test_should_allow_put_with_token\n assert_not_blocked { put :index, :authenticity_token => @token }\n end\n@@ -149,6 +157,11 @@ def test_should_allow_delete_with_token_in_header\n assert_not_blocked { delete :index }\n end\n \n+ def test_should_allow_patch_with_token_in_header\n+ @request.env['HTTP_X_CSRF_TOKEN'] = @token\n+ assert_not_blocked { patch :index }\n+ end\n+\n def test_should_allow_put_with_token_in_header\n @request.env['HTTP_X_CSRF_TOKEN'] = @token\n assert_not_blocked { put :index }\n@@ -210,7 +223,7 @@ def test_should_not_render_button_to_with_token_tag\n end\n \n def test_should_allow_all_methods_without_token\n- [:post, :put, :delete].each do |method|\n+ [:post, :patch, :put, :delete].each do |method|\n assert_nothing_raised { send(method, :index)}\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "79abcb069671608cddad64333d11d6f5a5de8962",
filename = "actionpack/test/controller/resources_test.rb",
status = "modified", additions = 22L, deletions = 9L, changes = 31L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/controller/resources_test.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/controller/resources_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/controller/resources_test.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -150,7 +150,7 @@ def test_with_name_prefix\n end\n \n def test_with_collection_actions\n- actions = { 'a' => :get, 'b' => :put, 'c' => :post, 'd' => :delete }\n+ actions = { 'a' => :get, 'b' => :put, 'c' => :post, 'd' => :delete, 'e' => :patch }\n \n with_routing do |set|\n set.draw do\n@@ -159,6 +159,7 @@ def test_with_collection_actions\n put :b, :on => :collection\n post :c, :on => :collection\n delete :d, :on => :collection\n+ patch :e, :on => :collection\n end\n end\n \n@@ -177,7 +178,7 @@ def test_with_collection_actions\n end\n \n def test_with_collection_actions_and_name_prefix\n- actions = { 'a' => :get, 'b' => :put, 'c' => :post, 'd' => :delete }\n+ actions = { 'a' => :get, 'b' => :put, 'c' => :post, 'd' => :delete, 'e' => :patch }\n \n with_routing do |set|\n set.draw do\n@@ -187,6 +188,7 @@ def test_with_collection_actions_and_name_prefix\n put :b, :on => :collection\n post :c, :on => :collection\n delete :d, :on => :collection\n+ patch :e, :on => :collection\n end\n end\n end\n@@ -233,7 +235,7 @@ def test_with_collection_actions_and_name_prefix_and_member_action_with_same_nam\n end\n \n def test_with_collection_action_and_name_prefix_and_formatted\n- actions = { 'a' => :get, 'b' => :put, 'c' => :post, 'd' => :delete }\n+ actions = { 'a' => :get, 'b' => :put, 'c' => :post, 'd' => :delete, 'e' => :patch }\n \n with_routing do |set|\n set.draw do\n@@ -243,6 +245,7 @@ def test_with_collection_action_and_name_prefix_and_formatted\n put :b, :on => :collection\n post :c, :on => :collection\n delete :d, :on => :collection\n+ patch :e, :on => :collection\n end\n end\n end\n@@ -262,7 +265,7 @@ def test_with_collection_action_and_name_prefix_and_formatted\n end\n \n def test_with_member_action\n- [:put, :post].each do |method|\n+ [:patch, :put, :post].each do |method|\n with_restful_routing :messages, :member => { :mark => method } do\n mark_options = {:action => 'mark', :id => '1'}\n mark_path = \"/messages/1/mark\"\n@@ -286,7 +289,7 @@ def test_with_member_action_and_requirement\n end\n \n def test_member_when_override_paths_for_default_restful_actions_with\n- [:put, :post].each do |method|\n+ [:patch, :put, :post].each do |method|\n with_restful_routing :messages, :member => { :mark => method }, :path_names => {:new => 'nuevo'} do\n mark_options = {:action => 'mark', :id => '1', :controller => \"messages\"}\n mark_path = \"/messages/1/mark\"\n@@ -303,7 +306,7 @@ def test_member_when_override_paths_for_default_restful_actions_with\n end\n \n def test_with_two_member_actions_with_same_method\n- [:put, :post].each do |method|\n+ [:patch, :put, :post].each do |method|\n with_routing do |set|\n set.draw do\n resources :messages do\n@@ -556,7 +559,7 @@ def test_should_create_nested_singleton_resource_routes\n end\n \n def test_singleton_resource_with_member_action\n- [:put, :post].each do |method|\n+ [:patch, :put, :post].each do |method|\n with_routing do |set|\n set.draw do\n resource :account do\n@@ -578,7 +581,7 @@ def test_singleton_resource_with_member_action\n end\n \n def test_singleton_resource_with_two_member_actions_with_same_method\n- [:put, :post].each do |method|\n+ [:patch, :put, :post].each do |method|\n with_routing do |set|\n set.draw do\n resource :account do\n@@ -643,13 +646,17 @@ def test_should_nest_singleton_resource_in_resources\n end\n end\n \n- def test_should_not_allow_delete_or_put_on_collection_path\n+ def test_should_not_allow_delete_or_patch_or_put_on_collection_path\n controller_name = :messages\n with_restful_routing controller_name do\n options = { :controller => controller_name.to_s }\n collection_path = \"/#{controller_name}\"\n \n assert_raise(ActionController::RoutingError) do\n+ assert_recognizes(options.merge(:action => 'update'), :path => collection_path, :method => :patch)\n+ end\n+\n+ assert_raise(ActionController::RoutingError) do\n assert_recognizes(options.merge(:action => 'update'), :path => collection_path, :method => :put)\n end\n \n@@ -1165,6 +1172,7 @@ def assert_restful_routes_for(controller_name, options = {})\n assert_recognizes(options[:shallow_options].merge(:action => 'show', :id => '1'), :path => member_path, :method => :get)\n assert_recognizes(options[:shallow_options].merge(:action => 'edit', :id => '1'), :path => edit_member_path, :method => :get)\n assert_recognizes(options[:shallow_options].merge(:action => 'update', :id => '1'), :path => member_path, :method => :put)\n+ assert_recognizes(options[:shallow_options].merge(:action => 'update', :id => '1'), :path => member_path, :method => :patch)\n assert_recognizes(options[:shallow_options].merge(:action => 'destroy', :id => '1'), :path => member_path, :method => :delete)\n \n assert_recognizes(options[:options].merge(:action => 'index', :format => 'xml'), :path => \"#{collection_path}.xml\", :method => :get)\n@@ -1173,6 +1181,7 @@ def assert_restful_routes_for(controller_name, options = {})\n assert_recognizes(options[:shallow_options].merge(:action => 'show', :id => '1', :format => 'xml'), :path => \"#{member_path}.xml\", :method => :get)\n assert_recognizes(options[:shallow_options].merge(:action => 'edit', :id => '1', :format => 'xml'), :path => formatted_edit_member_path, :method => :get)\n assert_recognizes(options[:shallow_options].merge(:action => 'update', :id => '1', :format => 'xml'), :path => \"#{member_path}.xml\", :method => :put)\n+ assert_recognizes(options[:shallow_options].merge(:action => 'update', :id => '1', :format => 'xml'), :path => \"#{member_path}.xml\", :method => :patch)\n assert_recognizes(options[:shallow_options].merge(:action => 'destroy', :id => '1', :format => 'xml'), :path => \"#{member_path}.xml\", :method => :delete)\n \n yield options[:options] if block_given?\n@@ -1252,6 +1261,7 @@ def assert_singleton_routes_for(singleton_name, options = {})\n assert_recognizes(options[:options].merge(:action => 'edit'), :path => edit_path, :method => :get)\n assert_recognizes(options[:options].merge(:action => 'create'), :path => full_path, :method => :post)\n assert_recognizes(options[:options].merge(:action => 'update'), :path => full_path, :method => :put)\n+ assert_recognizes(options[:options].merge(:action => 'update'), :path => full_path, :method => :patch)\n assert_recognizes(options[:options].merge(:action => 'destroy'), :path => full_path, :method => :delete)\n \n assert_recognizes(options[:options].merge(:action => 'show', :format => 'xml'), :path => \"#{full_path}.xml\", :method => :get)\n@@ -1259,6 +1269,7 @@ def assert_singleton_routes_for(singleton_name, options = {})\n assert_recognizes(options[:options].merge(:action => 'edit', :format => 'xml'), :path => formatted_edit_path, :method => :get)\n assert_recognizes(options[:options].merge(:action => 'create', :format => 'xml'), :path => \"#{full_path}.xml\", :method => :post)\n assert_recognizes(options[:options].merge(:action => 'update', :format => 'xml'), :path => \"#{full_path}.xml\", :method => :put)\n+ assert_recognizes(options[:options].merge(:action => 'update', :format => 'xml'), :path => \"#{full_path}.xml\", :method => :patch)\n assert_recognizes(options[:options].merge(:action => 'destroy', :format => 'xml'), :path => \"#{full_path}.xml\", :method => :delete)\n \n yield options[:options] if block_given?\n@@ -1310,6 +1321,7 @@ def assert_resource_allowed_routes(controller, options, shallow_options, allowed\n assert_whether_allowed(allowed, not_allowed, shallow_options, 'show', \"#{shallow_path}#{format}\", :get)\n assert_whether_allowed(allowed, not_allowed, shallow_options, 'edit', \"#{shallow_path}/edit#{format}\", :get)\n assert_whether_allowed(allowed, not_allowed, shallow_options, 'update', \"#{shallow_path}#{format}\", :put)\n+ assert_whether_allowed(allowed, not_allowed, shallow_options, 'update', \"#{shallow_path}#{format}\", :patch)\n assert_whether_allowed(allowed, not_allowed, shallow_options, 'destroy', \"#{shallow_path}#{format}\", :delete)\n end\n \n@@ -1322,6 +1334,7 @@ def assert_singleton_resource_allowed_routes(controller, options, allowed, not_a\n assert_whether_allowed(allowed, not_allowed, options, 'show', \"#{path}#{format}\", :get)\n assert_whether_allowed(allowed, not_allowed, options, 'edit', \"#{path}/edit#{format}\", :get)\n assert_whether_allowed(allowed, not_allowed, options, 'update', \"#{path}#{format}\", :put)\n+ assert_whether_allowed(allowed, not_allowed, options, 'update', \"#{path}#{format}\", :patch)\n assert_whether_allowed(allowed, not_allowed, options, 'destroy', \"#{path}#{format}\", :delete)\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "e3f1bb6ea3060f16e60b5104b7dc7b7587a70b8c",
filename = "actionpack/test/controller/routing_test.rb",
status = "modified", additions = 12L, deletions = 1L, changes = 13L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/controller/routing_test.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/controller/routing_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/controller/routing_test.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -531,11 +531,12 @@ def setup_request_method_routes_for(method)\n match '/match' => 'books#get', :via => :get\n match '/match' => 'books#post', :via => :post\n match '/match' => 'books#put', :via => :put\n+ match '/match' => 'books#patch', :via => :patch\n match '/match' => 'books#delete', :via => :delete\n end\n end\n \n- %w(GET POST PUT DELETE).each do |request_method|\n+ %w(GET PATCH POST PUT DELETE).each do |request_method|\n define_method(\"test_request_method_recognized_with_#{request_method}\") do\n setup_request_method_routes_for(request_method)\n params = rs.recognize_path(\"/match\", :method => request_method)\n@@ -918,6 +919,7 @@ def test_recognize_with_http_methods\n post \"/people\" => \"people#create\"\n get \"/people/:id\" => \"people#show\", :as => \"person\"\n put \"/people/:id\" => \"people#update\"\n+ patch \"/people/:id\" => \"people#update\"\n delete \"/people/:id\" => \"people#destroy\"\n end\n \n@@ -930,6 +932,9 @@ def test_recognize_with_http_methods\n params = set.recognize_path(\"/people/5\", :method => :put)\n assert_equal(\"update\", params[:action])\n \n+ params = set.recognize_path(\"/people/5\", :method => :patch)\n+ assert_equal(\"update\", params[:action])\n+\n assert_raise(ActionController::UnknownHttpMethod) {\n set.recognize_path(\"/people\", :method => :bacon)\n }\n@@ -942,6 +947,10 @@ def test_recognize_with_http_methods\n assert_equal(\"update\", params[:action])\n assert_equal(\"5\", params[:id])\n \n+ params = set.recognize_path(\"/people/5\", :method => :patch)\n+ assert_equal(\"update\", params[:action])\n+ assert_equal(\"5\", params[:id])\n+\n params = set.recognize_path(\"/people/5\", :method => :delete)\n assert_equal(\"destroy\", params[:action])\n assert_equal(\"5\", params[:id])\n@@ -1596,6 +1605,7 @@ def test_recognize_path\n assert_equal({:controller => 'admin/users', :action => 'new'}, @routes.recognize_path('/admin/users/new', :method => :get))\n assert_equal({:controller => 'admin/users', :action => 'show', :id => '1'}, @routes.recognize_path('/admin/users/1', :method => :get))\n assert_equal({:controller => 'admin/users', :action => 'update', :id => '1'}, @routes.recognize_path('/admin/users/1', :method => :put))\n+ assert_equal({:controller => 'admin/users', :action => 'update', :id => '1'}, @routes.recognize_path('/admin/users/1', :method => :patch))\n assert_equal({:controller => 'admin/users', :action => 'destroy', :id => '1'}, @routes.recognize_path('/admin/users/1', :method => :delete))\n assert_equal({:controller => 'admin/users', :action => 'edit', :id => '1'}, @routes.recognize_path('/admin/users/1/edit', :method => :get))\n \n@@ -1619,6 +1629,7 @@ def test_recognize_path\n assert_equal({:controller => 'people', :action => 'show', :id => '1'}, @routes.recognize_path('/people/1', :method => :get))\n assert_equal({:controller => 'people', :action => 'show', :id => '1', :format => 'xml'}, @routes.recognize_path('/people/1.xml', :method => :get))\n assert_equal({:controller => 'people', :action => 'update', :id => '1'}, @routes.recognize_path('/people/1', :method => :put))\n+ assert_equal({:controller => 'people', :action => 'update', :id => '1'}, @routes.recognize_path('/people/1', :method => :patch))\n assert_equal({:controller => 'people', :action => 'destroy', :id => '1'}, @routes.recognize_path('/people/1', :method => :delete))\n assert_equal({:controller => 'people', :action => 'edit', :id => '1'}, @routes.recognize_path('/people/1/edit', :method => :get))\n assert_equal({:controller => 'people', :action => 'edit', :id => '1', :format => 'xml'}, @routes.recognize_path('/people/1/edit.xml', :method => :get))"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "33f618fdb96265746be4816cb74eef3fc1b2db80",
filename = "actionpack/test/dispatch/request_test.rb", status = "modified",
additions = 4L, deletions = 4L, changes = 8L, blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/dispatch/request_test.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/dispatch/request_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/dispatch/request_test.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -308,14 +308,14 @@ def url_for(options = {})\n end\n \n test \"String request methods\" do\n- [:get, :post, :put, :delete].each do |method|\n+ [:get, :post, :patch, :put, :delete].each do |method|\n request = stub_request 'REQUEST_METHOD' => method.to_s.upcase\n assert_equal method.to_s.upcase, request.method\n end\n end\n \n test \"Symbol forms of request methods via method_symbol\" do\n- [:get, :post, :put, :delete].each do |method|\n+ [:get, :post, :patch, :put, :delete].each do |method|\n request = stub_request 'REQUEST_METHOD' => method.to_s.upcase\n assert_equal method, request.method_symbol\n end\n@@ -329,7 +329,7 @@ def url_for(options = {})\n end\n \n test \"allow method hacking on post\" do\n- %w(GET OPTIONS PUT POST DELETE).each do |method|\n+ %w(GET OPTIONS PATCH PUT POST DELETE).each do |method|\n request = stub_request \"REQUEST_METHOD\" => method.to_s.upcase\n assert_equal(method == \"HEAD\" ? \"GET\" : method, request.method)\n end\n@@ -343,7 +343,7 @@ def url_for(options = {})\n end\n \n test \"restrict method hacking\" do\n- [:get, :put, :delete].each do |method|\n+ [:get, :patch, :put, :delete].each do |method|\n request = stub_request 'REQUEST_METHOD' => method.to_s.upcase,\n 'action_dispatch.request.request_parameters' => { :_method => 'put' }\n assert_equal method.to_s.upcase, request.method"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "6921dfdbe8e283ac54a64b05164fcdd0d9138599",
filename = "actionpack/test/dispatch/routing_assertions_test.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/dispatch/routing_assertions_test.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/dispatch/routing_assertions_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/dispatch/routing_assertions_test.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -45,7 +45,7 @@ def test_assert_recognizes_with_extras\n \n def test_assert_recognizes_with_method\n assert_recognizes({ :controller => 'articles', :action => 'create' }, { :path => '/articles', :method => :post })\n- assert_recognizes({ :controller => 'articles', :action => 'update', :id => '1' }, { :path => '/articles/1', :method => :put })\n+ assert_recognizes({ :controller => 'articles', :action => 'update', :id => '1' }, { :path => '/articles/1', :method => :patch })\n end\n \n def test_assert_recognizes_with_hash_constraint"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "75a33fbc7c99e8b883f591e6af56b54278f42386",
filename = "actionpack/test/template/form_helper_test.rb",
status = "modified", additions = 52L, deletions = 52L, changes = 104L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/template/form_helper_test.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/template/form_helper_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/template/form_helper_test.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -635,7 +635,7 @@ def test_form_for\n concat f.submit('Create post')\n end\n \n- expected = whole_form(\"/posts/123\", \"create-post\" , \"edit_post\", :method => \"put\") do\n+ expected = whole_form(\"/posts/123\", \"create-post\" , \"edit_post\", :method => \"patch\") do\n \"<label for='post_title'>The Title</label>\" +\n \"<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />\" +\n \"<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>\" +\n@@ -654,7 +654,7 @@ def test_form_for_with_file_field_generate_multipart\n concat f.file_field(:file)\n end\n \n- expected = whole_form(\"/posts/123\", \"create-post\" , \"edit_post\", :method => \"put\", :multipart => true) do\n+ expected = whole_form(\"/posts/123\", \"create-post\" , \"edit_post\", :method => \"patch\", :multipart => true) do\n \"<input name='post[file]' type='file' id='post_file' />\"\n end\n \n@@ -670,7 +670,7 @@ def test_fields_for_with_file_field_generate_multipart\n }\n end\n \n- expected = whole_form(\"/posts/123\", \"edit_post_123\" , \"edit_post\", :method => \"put\", :multipart => true) do\n+ expected = whole_form(\"/posts/123\", \"edit_post_123\" , \"edit_post\", :method => \"patch\", :multipart => true) do\n \"<input name='post[comment][file]' type='file' id='post_comment_file' />\"\n end\n \n@@ -683,7 +683,7 @@ def test_form_for_with_format\n concat f.label(:title)\n end\n \n- expected = whole_form(\"/posts/123.json\", \"edit_post_123\" , \"edit_post\", :method => \"put\") do\n+ expected = whole_form(\"/posts/123.json\", \"edit_post_123\" , \"edit_post\", :method => \"patch\") do\n \"<label for='post_title'>Title</label>\"\n end\n \n@@ -714,7 +714,7 @@ def test_form_for_with_symbol_object_name\n concat f.submit('Create post')\n end\n \n- expected = whole_form(\"/posts/123\", \"create-post\", \"other_name_edit\", :method => \"put\") do\n+ expected = whole_form(\"/posts/123\", \"create-post\", \"other_name_edit\", :method => \"patch\") do\n \"<label for='other_name_title' class='post_title'>Title</label>\" +\n \"<input name='other_name[title]' size='30' id='other_name_title' value='Hello World' type='text' />\" +\n \"<textarea name='other_name[body]' id='other_name_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>\" +\n@@ -834,7 +834,7 @@ def test_form_for_with_index\n concat f.check_box(:secret)\n end\n \n- expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'put') do\n+ expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'patch') do\n \"<label for='post_123_title'>Title</label>\" +\n \"<input name='post[123][title]' size='30' type='text' id='post_123_title' value='Hello World' />\" +\n \"<textarea name='post[123][body]' id='post_123_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>\" +\n@@ -852,7 +852,7 @@ def test_form_for_with_nil_index_option_override\n concat f.check_box(:secret)\n end\n \n- expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'put') do\n+ expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'patch') do\n \"<input name='post[][title]' size='30' type='text' id='post__title' value='Hello World' />\" +\n \"<textarea name='post[][body]' id='post__body' rows='20' cols='40'>Back to the hill and over it again!</textarea>\" +\n \"<input name='post[][secret]' type='hidden' value='0' />\" +\n@@ -886,7 +886,7 @@ def test_submit_with_object_as_existing_record_and_locale_strings\n concat f.submit\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n \"<input name='commit' type='submit' value='Confirm Post changes' />\"\n end\n \n@@ -918,7 +918,7 @@ def test_submit_with_object_and_nested_lookup\n concat f.submit\n end\n \n- expected = whole_form('/posts/123', 'another_post_edit', 'another_post_edit', :method => 'put') do\n+ expected = whole_form('/posts/123', 'another_post_edit', 'another_post_edit', :method => 'patch') do\n \"<input name='commit' type='submit' value='Update your Post' />\"\n end\n \n@@ -935,7 +935,7 @@ def test_nested_fields_for\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n \"<input name='post[comment][body]' size='30' type='text' id='post_comment_body' value='Hello World' />\"\n end\n \n@@ -950,7 +950,7 @@ def test_nested_fields_for_with_nested_collections\n }\n end\n \n- expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'put') do\n+ expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'patch') do\n \"<input name='post[123][title]' size='30' type='text' id='post_123_title' value='Hello World' />\" +\n \"<input name='post[123][comment][][name]' size='30' type='text' id='post_123_comment__name' value='new comment' />\"\n end\n@@ -966,7 +966,7 @@ def test_nested_fields_for_with_index_and_parent_fields\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', 'patch') do\n \"<input name='post[1][title]' size='30' type='text' id='post_1_title' value='Hello World' />\" +\n \"<input name='post[1][comment][1][name]' size='30' type='text' id='post_1_comment_1_name' value='new comment' />\"\n end\n@@ -981,7 +981,7 @@ def test_form_for_with_index_and_nested_fields_for\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', 'patch') do\n \"<input name='post[1][comment][title]' size='30' type='text' id='post_1_comment_title' value='Hello World' />\"\n end\n \n@@ -995,7 +995,7 @@ def test_nested_fields_for_with_index_on_both\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', 'patch') do\n \"<input name='post[1][comment][5][title]' size='30' type='text' id='post_1_comment_5_title' value='Hello World' />\"\n end\n \n@@ -1009,7 +1009,7 @@ def test_nested_fields_for_with_auto_index\n }\n end\n \n- expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'put') do\n+ expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'patch') do\n \"<input name='post[123][comment][title]' size='30' type='text' id='post_123_comment_title' value='Hello World' />\"\n end\n \n@@ -1023,7 +1023,7 @@ def test_nested_fields_for_with_index_radio_button\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', 'patch') do\n \"<input name='post[comment][5][title]' type='radio' id='post_comment_5_title_hello' value='hello' />\"\n end\n \n@@ -1037,7 +1037,7 @@ def test_nested_fields_for_with_auto_index_on_both\n }\n end\n \n- expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'put') do\n+ expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'patch') do\n \"<input name='post[123][comment][123][title]' size='30' type='text' id='post_123_comment_123_title' value='Hello World' />\"\n end\n \n@@ -1057,9 +1057,9 @@ def test_nested_fields_for_with_index_and_auto_index\n }\n end\n \n- expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'put') do\n+ expected = whole_form('/posts/123', 'post[]_edit', 'post[]_edit', 'patch') do\n \"<input name='post[123][comment][5][title]' size='30' type='text' id='post_123_comment_5_title' value='Hello World' />\"\n- end + whole_form('/posts/123', 'post_edit', 'post_edit', 'put') do\n+ end + whole_form('/posts/123', 'post_edit', 'post_edit', 'patch') do\n \"<input name='post[1][comment][123][title]' size='30' type='text' id='post_1_comment_123_title' value='Hello World' />\"\n end\n \n@@ -1076,7 +1076,7 @@ def test_nested_fields_for_with_a_new_record_on_a_nested_attributes_one_to_one_a\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_author_attributes_name\" name=\"post[author_attributes][name]\" size=\"30\" type=\"text\" value=\"new author\" />'\n end\n@@ -1103,7 +1103,7 @@ def test_nested_fields_for_with_an_existing_record_on_a_nested_attributes_one_to\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_author_attributes_name\" name=\"post[author_attributes][name]\" size=\"30\" type=\"text\" value=\"author #321\" />' +\n '<input id=\"post_author_attributes_id\" name=\"post[author_attributes][id]\" type=\"hidden\" value=\"321\" />'\n@@ -1122,7 +1122,7 @@ def test_nested_fields_for_with_an_existing_record_on_a_nested_attributes_one_to\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_author_attributes_name\" name=\"post[author_attributes][name]\" size=\"30\" type=\"text\" value=\"author #321\" />' +\n '<input id=\"post_author_attributes_id\" name=\"post[author_attributes][id]\" type=\"hidden\" value=\"321\" />'\n@@ -1141,7 +1141,7 @@ def test_nested_fields_for_with_an_existing_record_on_a_nested_attributes_one_to\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_author_attributes_name\" name=\"post[author_attributes][name]\" size=\"30\" type=\"text\" value=\"author #321\" />'\n end\n@@ -1159,7 +1159,7 @@ def test_nested_fields_for_with_an_existing_record_on_a_nested_attributes_one_to\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_author_attributes_name\" name=\"post[author_attributes][name]\" size=\"30\" type=\"text\" value=\"author #321\" />'\n end\n@@ -1177,7 +1177,7 @@ def test_nested_fields_for_with_an_existing_record_on_a_nested_attributes_one_to\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_author_attributes_name\" name=\"post[author_attributes][name]\" size=\"30\" type=\"text\" value=\"author #321\" />' +\n '<input id=\"post_author_attributes_id\" name=\"post[author_attributes][id]\" type=\"hidden\" value=\"321\" />'\n@@ -1197,7 +1197,7 @@ def test_nested_fields_for_with_existing_records_on_a_nested_attributes_one_to_o\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_author_attributes_id\" name=\"post[author_attributes][id]\" type=\"hidden\" value=\"321\" />' +\n '<input id=\"post_author_attributes_name\" name=\"post[author_attributes][name]\" size=\"30\" type=\"text\" value=\"author #321\" />'\n@@ -1218,7 +1218,7 @@ def test_nested_fields_for_with_existing_records_on_a_nested_attributes_collecti\n end\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_comments_attributes_0_name\" name=\"post[comments_attributes][0][name]\" size=\"30\" type=\"text\" value=\"comment #1\" />' +\n '<input id=\"post_comments_attributes_0_id\" name=\"post[comments_attributes][0][id]\" type=\"hidden\" value=\"1\" />' +\n@@ -1245,7 +1245,7 @@ def test_nested_fields_for_with_existing_records_on_a_nested_attributes_collecti\n end\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_author_attributes_name\" name=\"post[author_attributes][name]\" size=\"30\" type=\"text\" value=\"author #321\" />' +\n '<input id=\"post_author_attributes_id\" name=\"post[author_attributes][id]\" type=\"hidden\" value=\"321\" />' +\n@@ -1272,7 +1272,7 @@ def test_nested_fields_for_with_existing_records_on_a_nested_attributes_collecti\n end\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_author_attributes_name\" name=\"post[author_attributes][name]\" size=\"30\" type=\"text\" value=\"author #321\" />' +\n '<input id=\"post_comments_attributes_0_name\" name=\"post[comments_attributes][0][name]\" size=\"30\" type=\"text\" value=\"comment #1\" />' +\n@@ -1298,7 +1298,7 @@ def test_nested_fields_for_with_existing_records_on_a_nested_attributes_collecti\n end\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_author_attributes_name\" name=\"post[author_attributes][name]\" size=\"30\" type=\"text\" value=\"author #321\" />' +\n '<input id=\"post_author_attributes_id\" name=\"post[author_attributes][id]\" type=\"hidden\" value=\"321\" />' +\n@@ -1321,7 +1321,7 @@ def test_nested_fields_for_with_existing_records_on_a_nested_attributes_collecti\n end\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_comments_attributes_0_name\" name=\"post[comments_attributes][0][name]\" size=\"30\" type=\"text\" value=\"comment #1\" />' +\n '<input id=\"post_comments_attributes_0_id\" name=\"post[comments_attributes][0][id]\" type=\"hidden\" value=\"1\" />' +\n@@ -1345,7 +1345,7 @@ def test_nested_fields_for_with_existing_records_on_a_nested_attributes_collecti\n end\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_comments_attributes_0_id\" name=\"post[comments_attributes][0][id]\" type=\"hidden\" value=\"1\" />' +\n '<input id=\"post_comments_attributes_0_name\" name=\"post[comments_attributes][0][name]\" size=\"30\" type=\"text\" value=\"comment #1\" />' +\n@@ -1368,7 +1368,7 @@ def test_nested_fields_for_with_new_records_on_a_nested_attributes_collection_as\n end\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_comments_attributes_0_name\" name=\"post[comments_attributes][0][name]\" size=\"30\" type=\"text\" value=\"new comment\" />' +\n '<input id=\"post_comments_attributes_1_name\" name=\"post[comments_attributes][1][name]\" size=\"30\" type=\"text\" value=\"new comment\" />'\n@@ -1389,7 +1389,7 @@ def test_nested_fields_for_with_existing_and_new_records_on_a_nested_attributes_\n end\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_comments_attributes_0_name\" name=\"post[comments_attributes][0][name]\" size=\"30\" type=\"text\" value=\"comment #321\" />' +\n '<input id=\"post_comments_attributes_0_id\" name=\"post[comments_attributes][0][id]\" type=\"hidden\" value=\"321\" />' +\n@@ -1407,7 +1407,7 @@ def test_nested_fields_for_with_an_empty_supplied_attributes_collection\n end\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />'\n end\n \n@@ -1424,7 +1424,7 @@ def test_nested_fields_for_with_existing_records_on_a_supplied_nested_attributes\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_comments_attributes_0_name\" name=\"post[comments_attributes][0][name]\" size=\"30\" type=\"text\" value=\"comment #1\" />' +\n '<input id=\"post_comments_attributes_0_id\" name=\"post[comments_attributes][0][id]\" type=\"hidden\" value=\"1\" />' +\n@@ -1445,7 +1445,7 @@ def test_nested_fields_for_arel_like\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_comments_attributes_0_name\" name=\"post[comments_attributes][0][name]\" size=\"30\" type=\"text\" value=\"comment #1\" />' +\n '<input id=\"post_comments_attributes_0_id\" name=\"post[comments_attributes][0][id]\" type=\"hidden\" value=\"1\" />' +\n@@ -1467,7 +1467,7 @@ def test_nested_fields_for_with_existing_records_on_a_supplied_nested_attributes\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_comments_attributes_0_name\" name=\"post[comments_attributes][0][name]\" size=\"30\" type=\"text\" value=\"comment #1\" />' +\n '<input id=\"post_comments_attributes_0_id\" name=\"post[comments_attributes][0][id]\" type=\"hidden\" value=\"1\" />' +\n@@ -1490,7 +1490,7 @@ def test_nested_fields_for_on_a_nested_attributes_collection_association_yields_\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input name=\"post[title]\" size=\"30\" type=\"text\" id=\"post_title\" value=\"Hello World\" />' +\n '<input id=\"post_comments_attributes_0_name\" name=\"post[comments_attributes][0][name]\" size=\"30\" type=\"text\" value=\"comment #321\" />' +\n '<input id=\"post_comments_attributes_0_id\" name=\"post[comments_attributes][0][id]\" type=\"hidden\" value=\"321\" />' +\n@@ -1510,7 +1510,7 @@ def test_nested_fields_for_with_child_index_option_override_on_a_nested_attribut\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input id=\"post_comments_attributes_abc_name\" name=\"post[comments_attributes][abc][name]\" size=\"30\" type=\"text\" value=\"comment #321\" />' +\n '<input id=\"post_comments_attributes_abc_id\" name=\"post[comments_attributes][abc][id]\" type=\"hidden\" value=\"321\" />'\n end\n@@ -1546,7 +1546,7 @@ def test_nested_fields_uses_unique_indices_for_different_collection_associations\n }\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n '<input id=\"post_comments_attributes_0_name\" name=\"post[comments_attributes][0][name]\" size=\"30\" type=\"text\" value=\"comment #321\" />' +\n '<input id=\"post_comments_attributes_0_relevances_attributes_0_value\" name=\"post[comments_attributes][0][relevances_attributes][0][value]\" size=\"30\" type=\"text\" value=\"commentrelevance #314\" />' +\n '<input id=\"post_comments_attributes_0_relevances_attributes_0_id\" name=\"post[comments_attributes][0][relevances_attributes][0][id]\" type=\"hidden\" value=\"314\" />' +\n@@ -1696,7 +1696,7 @@ def test_form_for_and_fields_for\n }\n end\n \n- expected = whole_form('/posts/123', 'create-post', 'post_edit', :method => 'put') do\n+ expected = whole_form('/posts/123', 'create-post', 'post_edit', :method => 'patch') do\n \"<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />\" +\n \"<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>\" +\n \"<input name='parent_post[secret]' type='hidden' value='0' />\" +\n@@ -1716,7 +1716,7 @@ def test_form_for_and_fields_for_with_object\n }\n end\n \n- expected = whole_form('/posts/123', 'create-post', 'post_edit', :method => 'put') do\n+ expected = whole_form('/posts/123', 'create-post', 'post_edit', :method => 'patch') do\n \"<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />\" +\n \"<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>\" +\n \"<input name='post[comment][name]' type='text' id='post_comment_name' value='new comment' size='30' />\"\n@@ -1742,7 +1742,7 @@ def test_form_for_with_labelled_builder\n concat f.check_box(:secret)\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n \"<label for='title'>Title:</label> <input name='post[title]' size='30' type='text' id='post_title' value='Hello World' /><br/>\" +\n \"<label for='body'>Body:</label> <textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea><br/>\" +\n \"<label for='secret'>Secret:</label> <input name='post[secret]' type='hidden' value='0' /><input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' /><br/>\"\n@@ -1792,7 +1792,7 @@ def test_default_form_builder\n concat f.check_box(:secret)\n end\n \n- expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'put') do\n+ expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do\n \"<label for='title'>Title:</label> <input name='post[title]' size='30' type='text' id='post_title' value='Hello World' /><br/>\" +\n \"<label for='body'>Body:</label> <textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea><br/>\" +\n \"<label for='secret'>Secret:</label> <input name='post[secret]' type='hidden' value='0' /><input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' /><br/>\"\n@@ -1861,7 +1861,7 @@ def test_form_for_with_labelled_builder_with_nested_fields_for_with_custom_build\n \n def test_form_for_with_html_options_adds_options_to_form_tag\n form_for(@post, :html => {:id => 'some_form', :class => 'some_class'}) do |f| end\n- expected = whole_form(\"/posts/123\", \"some_form\", \"some_class\", 'put')\n+ expected = whole_form(\"/posts/123\", \"some_form\", \"some_class\", 'patch')\n \n assert_dom_equal expected, output_buffer\n end\n@@ -1869,7 +1869,7 @@ def test_form_for_with_html_options_adds_options_to_form_tag\n def test_form_for_with_string_url_option\n form_for(@post, :url => 'http://www.otherdomain.com') do |f| end\n \n- assert_equal whole_form(\"http://www.otherdomain.com\", 'edit_post_123', 'edit_post', 'put'), output_buffer\n+ assert_equal whole_form(\"http://www.otherdomain.com\", 'edit_post_123', 'edit_post', 'patch'), output_buffer\n end\n \n def test_form_for_with_hash_url_option\n@@ -1882,14 +1882,14 @@ def test_form_for_with_hash_url_option\n def test_form_for_with_record_url_option\n form_for(@post, :url => @post) do |f| end\n \n- expected = whole_form(\"/posts/123\", 'edit_post_123', 'edit_post', 'put')\n+ expected = whole_form(\"/posts/123\", 'edit_post_123', 'edit_post', 'patch')\n assert_equal expected, output_buffer\n end\n \n def test_form_for_with_existing_object\n form_for(@post) do |f| end\n \n- expected = whole_form(\"/posts/123\", \"edit_post_123\", \"edit_post\", \"put\")\n+ expected = whole_form(\"/posts/123\", \"edit_post_123\", \"edit_post\", \"patch\")\n assert_equal expected, output_buffer\n end\n \n@@ -1908,7 +1908,7 @@ def test_form_for_with_existing_object_in_list\n @comment.save\n form_for([@post, @comment]) {}\n \n- expected = whole_form(post_comment_path(@post, @comment), \"edit_comment_1\", \"edit_comment\", \"put\")\n+ expected = whole_form(post_comment_path(@post, @comment), \"edit_comment_1\", \"edit_comment\", \"patch\")\n assert_dom_equal expected, output_buffer\n end\n \n@@ -1923,7 +1923,7 @@ def test_form_for_with_existing_object_and_namespace_in_list\n @comment.save\n form_for([:admin, @post, @comment]) {}\n \n- expected = whole_form(admin_post_comment_path(@post, @comment), \"edit_comment_1\", \"edit_comment\", \"put\")\n+ expected = whole_form(admin_post_comment_path(@post, @comment), \"edit_comment_1\", \"edit_comment\", \"patch\")\n assert_dom_equal expected, output_buffer\n end\n \n@@ -1937,7 +1937,7 @@ def test_form_for_with_new_object_and_namespace_in_list\n def test_form_for_with_existing_object_and_custom_url\n form_for(@post, :url => \"/super_posts\") do |f| end\n \n- expected = whole_form(\"/super_posts\", \"edit_post_123\", \"edit_post\", \"put\")\n+ expected = whole_form(\"/super_posts\", \"edit_post_123\", \"edit_post\", \"patch\")\n assert_equal expected, output_buffer\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "b53a051d8023b4287c8636aa32dd37594a3e91d6",
filename = "actionpack/test/template/form_tag_helper_test.rb",
status = "modified", additions = 6L, deletions = 0L, changes = 6L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/template/form_tag_helper_test.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/actionpack/test/template/form_tag_helper_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/template/form_tag_helper_test.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -76,6 +76,12 @@ def test_form_tag_multipart\n assert_dom_equal expected, actual\n end\n \n+ def test_form_tag_with_method_patch\n+ actual = form_tag({}, { :method => :patch })\n+ expected = whole_form(\"http://www.example.com\", :method => :patch)\n+ assert_dom_equal expected, actual\n+ end\n+\n def test_form_tag_with_method_put\n actual = form_tag({}, { :method => :put })\n expected = whole_form(\"http://www.example.com\", :method => :put)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "29bc47a30a0dd10b03f22f8d26bc3d047ea8e564",
filename = "activemodel/lib/active_model/lint.rb", status = "modified",
additions = 1L, deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/activemodel/lib/active_model/lint.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/activemodel/lib/active_model/lint.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/lib/active_model/lint.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -57,7 +57,7 @@ def test_valid?\n # Returns a boolean that specifies whether the object has been persisted yet.\n # This is used when calculating the URL for an object. If the object is\n # not persisted, a form for that object, for instance, will be POSTed to the\n- # collection. If it is persisted, a form for the object will be PUT to the\n+ # collection. If it is persisted, a form for the object will PATCH to the\n # URL for the object.\n def test_persisted?\n assert model.respond_to?(:persisted?), \"The model should respond to persisted?\""), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "8826b6f20f14d486be24ddbcbc6099678d2595ce",
filename = "activeresource/lib/active_resource/connection.rb",
status = "modified", additions = 7L, deletions = 0L, changes = 7L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/activeresource/lib/active_resource/connection.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/activeresource/lib/active_resource/connection.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/connection.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -15,6 +15,7 @@ class Connection\n HTTP_FORMAT_HEADER_NAMES = { :get => 'Accept',\n :put => 'Content-Type',\n :post => 'Content-Type',\n+ :patch => 'Content-Type',\n :delete => 'Accept',\n :head => 'Accept'\n }\n@@ -86,6 +87,12 @@ def delete(path, headers = {})\n with_auth { request(:delete, path, build_request_headers(headers, :delete, self.site.merge(path))) }\n end\n \n+ # Executes a PATCH request (see HTTP protocol documentation if unfamiliar).\n+ # Used to update resources.\n+ def patch(path, body = '', headers = {})\n+ with_auth { request(:patch, path, body.to_s, build_request_headers(headers, :patch, self.site.merge(path))) }\n+ end\n+\n # Executes a PUT request (see HTTP protocol documentation if unfamiliar).\n # Used to update resources.\n def put(path, body = '', headers = {})"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "32f9c82bda82204ccca8e4156f50bc99dacf599d",
filename = "activeresource/lib/active_resource/custom_methods.rb",
status = "modified", additions = 10L, deletions = 0L, changes = 10L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/activeresource/lib/active_resource/custom_methods.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/activeresource/lib/active_resource/custom_methods.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/custom_methods.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -13,6 +13,7 @@ module ActiveResource\n #\n # POST /people/new/register.xml # PeopleController.register\n # PUT /people/1/promote.xml # PeopleController.promote with :id => 1\n+ # PATCH /people/1/promote.xml # PeopleController.promote with :id => 1\n # DELETE /people/1/deactivate.xml # PeopleController.deactivate with :id => 1\n # GET /people/active.xml # PeopleController.active\n #\n@@ -27,6 +28,7 @@ module ActiveResource\n # # => { :id => 1, :name => 'Ryan' }\n #\n # Person.find(1).put(:promote, :position => 'Manager') # PUT /people/1/promote.xml\n+ # Person.find(1).patch(:promote, :position => 'Manager') # PATCH /people/1/promote.xml\n # Person.find(1).delete(:deactivate) # DELETE /people/1/deactivate.xml\n #\n # Person.get(:active) # GET /people/active.xml\n@@ -61,6 +63,10 @@ def post(custom_method_name, options = {}, body = '')\n connection.post(custom_method_collection_url(custom_method_name, options), body, headers)\n end\n \n+ def patch(custom_method_name, options = {}, body = '')\n+ connection.patch(custom_method_collection_url(custom_method_name, options), body, headers)\n+ end\n+\n def put(custom_method_name, options = {}, body = '')\n connection.put(custom_method_collection_url(custom_method_name, options), body, headers)\n end\n@@ -97,6 +103,10 @@ def post(method_name, options = {}, body = nil)\n end\n end\n \n+ def patch(method_name, options = {}, body = '')\n+ connection.patch(custom_method_element_url(method_name, options), body, self.class.headers)\n+ end\n+\n def put(method_name, options = {}, body = '')\n connection.put(custom_method_element_url(method_name, options), body, self.class.headers)\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d264b865e8af44f79e0ba2ef573ff55e9427715d",
filename = "activeresource/lib/active_resource/http_mock.rb",
status = "modified", additions = 5L, deletions = 3L, changes = 8L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/activeresource/lib/active_resource/http_mock.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/activeresource/lib/active_resource/http_mock.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/lib/active_resource/http_mock.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -15,7 +15,7 @@ class InvalidRequestError < StandardError; end #:nodoc:\n #\n # mock.http_method(path, request_headers = {}, body = nil, status = 200, response_headers = {})\n #\n- # * <tt>http_method</tt> - The HTTP method to listen for. This can be +get+, +post+, +put+, +delete+ or\n+ # * <tt>http_method</tt> - The HTTP method to listen for. This can be +get+, +post+, +patch+, +put+, +delete+ or\n # +head+.\n # * <tt>path</tt> - A string, starting with a \"/\", defining the URI that is expected to be\n # called.\n@@ -39,6 +39,7 @@ class InvalidRequestError < StandardError; end #:nodoc:\n # ActiveResource::HttpMock.respond_to do |mock|\n # mock.post \"/people.xml\", {}, @matz, 201, \"Location\" => \"/people/1.xml\"\n # mock.get \"/people/1.xml\", {}, @matz\n+ # mock.patch \"/people/1.xml\", {}, nil, 204\n # mock.put \"/people/1.xml\", {}, nil, 204\n # mock.delete \"/people/1.xml\", {}, nil, 200\n # end\n@@ -55,7 +56,7 @@ def initialize(responses)\n @responses = responses\n end\n \n- for method in [ :post, :put, :get, :delete, :head ]\n+ for method in [ :post, :patch, :put, :get, :delete, :head ]\n # def post(path, request_headers = {}, body = nil, status = 200, response_headers = {})\n # @responses[Request.new(:post, path, nil, request_headers)] = Response.new(body || \"\", status, response_headers)\n # end\n@@ -121,6 +122,7 @@ def responses\n # ActiveResource::HttpMock.respond_to do |mock|\n # mock.post \"/people.xml\", {}, @matz, 201, \"Location\" => \"/people/1.xml\"\n # mock.get \"/people/1.xml\", {}, @matz\n+ # mock.patch \"/people/1.xml\", {}, nil, 204\n # mock.put \"/people/1.xml\", {}, nil, 204\n # mock.delete \"/people/1.xml\", {}, nil, 200\n # end\n@@ -217,7 +219,7 @@ def reset!\n end\n \n # body? methods\n- { true => %w(post put),\n+ { true => %w(post patch put),\n false => %w(get delete head) }.each do |has_body, methods|\n methods.each do |method|\n # def post(path, body, headers)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "38d67244fe08e81b159b2cde944b7abbc7fa4a18",
filename = "activeresource/test/cases/format_test.rb", status = "modified",
additions = 8L, deletions = 4L, changes = 12L, blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/activeresource/test/cases/format_test.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/activeresource/test/cases/format_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/test/cases/format_test.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -11,11 +11,15 @@ def setup\n end\n \n def test_http_format_header_name\n- header_name = ActiveResource::Connection::HTTP_FORMAT_HEADER_NAMES[:get]\n- assert_equal 'Accept', header_name\n+ [:get, :head].each do |verb|\n+ header_name = ActiveResource::Connection::HTTP_FORMAT_HEADER_NAMES[verb]\n+ assert_equal 'Accept', header_name\n+ end\n \n- headers_names = [ActiveResource::Connection::HTTP_FORMAT_HEADER_NAMES[:put], ActiveResource::Connection::HTTP_FORMAT_HEADER_NAMES[:post]]\n- headers_names.each{ |name| assert_equal 'Content-Type', name }\n+ [:patch, :put, :post].each do |verb|\n+ header_name = ActiveResource::Connection::HTTP_FORMAT_HEADER_NAMES[verb]\n+ assert_equal 'Content-Type', header_name\n+ end\n end\n \n def test_formats_on_single_element"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "c4e3b519c291a2691ef523c7e33198a7d9c0e9f7",
filename = "activeresource/test/cases/http_mock_test.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/activeresource/test/cases/http_mock_test.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/activeresource/test/cases/http_mock_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/test/cases/http_mock_test.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -8,7 +8,7 @@ class HttpMockTest < ActiveSupport::TestCase\n \n FORMAT_HEADER = ActiveResource::Connection::HTTP_FORMAT_HEADER_NAMES\n \n- [:post, :put, :get, :delete, :head].each do |method|\n+ [:post, :patch, :put, :get, :delete, :head].each do |method|\n test \"responds to simple #{method} request\" do\n ActiveResource::HttpMock.respond_to do |mock|\n mock.send(method, \"/people/1\", {FORMAT_HEADER[method] => \"application/xml\"}, \"Response\")\n@@ -193,7 +193,7 @@ class HttpMockTest < ActiveSupport::TestCase\n end\n \n def request(method, path, headers = {}, body = nil)\n- if method.in?([:put, :post])\n+ if method.in?([:patch, :put, :post])\n @http.send(method, path, body, headers)\n else\n @http.send(method, path, headers)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "905d2b10dee728d01b5c53b2b9177e8fbb2dcf73",
filename = "railties/guides/source/action_controller_overview.textile",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/guides/source/action_controller_overview.textile",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/guides/source/action_controller_overview.textile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/guides/source/action_controller_overview.textile?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -535,7 +535,7 @@ The request object contains a lot of useful information about the request coming\n |domain(n=2)|The hostname's first +n+ segments, starting from the right (the TLD).|\n |format|The content type requested by the client.|\n |method|The HTTP method used for the request.|\n-|get?, post?, put?, delete?, head?|Returns true if the HTTP method is GET/POST/PUT/DELETE/HEAD.|\n+|get?, post?, patch?, put?, delete?, head?|Returns true if the HTTP method is GET/POST/PATCH/PUT/DELETE/HEAD.|\n |headers|Returns a hash containing the headers associated with the request.|\n |port|The port number (integer) used for the request.|\n |protocol|Returns a string containing the protocol used plus \"://\", for example \"http://\".|"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "0ebfded7efc57183872f644ec3fa6cdd915b55bf",
filename = "railties/guides/source/ajax_on_rails.textile",
status = "modified", additions = 3L, deletions = 2L, changes = 5L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/guides/source/ajax_on_rails.textile",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/guides/source/ajax_on_rails.textile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/guides/source/ajax_on_rails.textile?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -87,7 +87,8 @@ link_to_remote \"Add new item\",\n :position => :bottom\n </ruby>\n \n-** *:method* Most typically you want to use a POST request when adding a remote link to your view so this is the default behavior. However, sometimes you'll want to update (PUT) or delete/destroy (DELETE) something and you can specify this with the +:method+ option. Let's see an example for a typical AJAX link for deleting an item from a list:\n+** *:method* Most typically you want to use a POST request when adding a remote\n+link to your view so this is the default behavior. However, sometimes you'll want to update (PATCH) or delete/destroy (DELETE) something and you can specify this with the +:method+ option. Let's see an example for a typical AJAX link for deleting an item from a list:\n \n <ruby>\n link_to_remote \"Delete the item\",\n@@ -108,7 +109,7 @@ Note that if we wouldn't override the default behavior (POST), the above snippet\n <ruby>\n link_to_remote \"Update record\",\n :url => record_url(record),\n- :method => :put,\n+ :method => :patch,\n :with => \"'status=' + 'encodeURIComponent($('status').value) + '&completed=' + $('completed')\"\n </ruby>\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "1989500adb9b493ac4f8302616708cc7a1a757d1",
filename = "railties/guides/source/configuring.textile",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/guides/source/configuring.textile",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/guides/source/configuring.textile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/guides/source/configuring.textile?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -165,7 +165,7 @@ Every Rails application comes with a standard set of middleware which it uses in\n * +ActionDispatch::Session::CookieStore+ is responsible for storing the session in cookies. An alternate middleware can be used for this by changing the +config.action_controller.session_store+ to an alternate value. Additionally, options passed to this can be configured by using +config.action_controller.session_options+.\n * +ActionDispatch::Flash+ sets up the +flash+ keys. Only available if +config.action_controller.session_store+ is set to a value.\n * +ActionDispatch::ParamsParser+ parses out parameters from the request into +params+\n-* +Rack::MethodOverride+ allows the method to be overridden if +params[:_method]+ is set. This is the middleware which supports the PUT and DELETE HTTP method types.\n+* +Rack::MethodOverride+ allows the method to be overridden if * +params[:_method]+ is set. This is the middleware which supports the PATCH, * PUT, and DELETE HTTP method types.\n * +ActionDispatch::Head+ converts HEAD requests to GET requests and serves them as so.\n * +ActionDispatch::BestStandardsSupport+ enables \"best standards support\" so that IE8 renders some elements correctly.\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "a78f1d313d36f847ba753744776bc56f6ae27152",
filename = "railties/guides/source/form_helpers.textile",
status = "modified", additions = 6L, deletions = 6L, changes = 12L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/guides/source/form_helpers.textile",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/guides/source/form_helpers.textile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/guides/source/form_helpers.textile?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -301,7 +301,7 @@ form_for(@article)\n \n ## Editing an existing article\n # long-style:\n-form_for(@article, :url => article_path(@article), :html => { :method => \"put\" })\n+form_for(@article, :url => article_path(@article), :html => { :method => \"patch\" })\n # short-style:\n form_for(@article)\n </ruby>\n@@ -329,14 +329,14 @@ form_for [:admin, :management, @article]\n For more information on Rails' routing system and the associated conventions, please see the \"routing guide\":routing.html.\n \n \n-h4. How do forms with PUT or DELETE methods work?\n+h4. How do forms with PATCH or DELETE methods work?\n \n-The Rails framework encourages RESTful design of your applications, which means you'll be making a lot of \"PUT\" and \"DELETE\" requests (besides \"GET\" and \"POST\"). However, most browsers _don't support_ methods other than \"GET\" and \"POST\" when it comes to submitting forms.\n+The Rails framework encourages RESTful design of your applications, which means you'll be making a lot of \"PATCH\" and \"DELETE\" requests (besides \"GET\" and \"POST\"). However, most browsers _don't support_ methods other than \"GET\" and \"POST\" when it comes to submitting forms.\n \n Rails works around this issue by emulating other methods over POST with a hidden input named +\"_method\"+, which is set to reflect the desired method:\n \n <ruby>\n-form_tag(search_path, :method => \"put\")\n+form_tag(search_path, :method => \"patch\")\n </ruby>\n \n output:\n@@ -344,14 +344,14 @@ output:\n <html>\n <form accept-charset=\"UTF-8\" action=\"/search\" method=\"post\">\n <div style=\"margin:0;padding:0\">\n- <input name=\"_method\" type=\"hidden\" value=\"put\" />\n+ <input name=\"_method\" type=\"hidden\" value=\"patch\" />\n <input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" />\n <input name=\"authenticity_token\" type=\"hidden\" value=\"f755bb0ed134b76c432144748a6d4b7a7ddf2b71\" />\n </div>\n ...\n </html>\n \n-When parsing POSTed data, Rails will take into account the special +_method+ parameter and acts as if the HTTP method was the one specified inside it (\"PUT\" in this example).\n+When parsing POSTed data, Rails will take into account the special +_method+ parameter and acts as if the HTTP method was the one specified inside it (\"PATCH\" in this example).\n \n \n h3. Making Select Boxes with Ease"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "04c4fe5f109f4fe29b5a2e58681f553cf0b587d9",
filename = "railties/guides/source/getting_started.textile",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/guides/source/getting_started.textile",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/guides/source/getting_started.textile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/guides/source/getting_started.textile?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -729,7 +729,7 @@ After finding the requested post, Rails uses the +edit.html.erb+ view to display\n <%= link_to 'Back', posts_path %>\n </erb>\n \n-Again, as with the +new+ action, the +edit+ action is using the +form+ partial, this time however, the form will do a PUT action to the PostsController and the submit button will display \"Update Post\"\n+Again, as with the +new+ action, the +edit+ action is using the +form+ partial, this time however, the form will do a PATCH action to the PostsController and the submit button will display \"Update Post\"\n \n Submitting the form created by this view will invoke the +update+ action within the controller:\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "3c56c17dc5ecf5bfbf8383b3fa316edeca85ae71",
filename = "railties/guides/source/routing.textile", status = "modified",
additions = 14L, deletions = 6L, changes = 20L, blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/guides/source/routing.textile",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/guides/source/routing.textile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/guides/source/routing.textile?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -50,7 +50,7 @@ Resource routing allows you to quickly declare all of the common routes for a gi\n \n h4. Resources on the Web\n \n-Browsers request pages from Rails by making a request for a URL using a specific HTTP method, such as +GET+, +POST+, +PUT+ and +DELETE+. Each method is a request to perform an operation on the resource. A resource route maps a number of related requests to actions in a single controller.\n+Browsers request pages from Rails by making a request for a URL using a specific HTTP method, such as +GET+, +POST+, +PATCH+, +PUT+ and +DELETE+. Each method is a request to perform an operation on the resource. A resource route maps a number of related requests to actions in a single controller.\n \n When your Rails application receives an incoming request for\n \n@@ -74,7 +74,7 @@ In Rails, a resourceful route provides a mapping between HTTP verbs and URLs and\n resources :photos\n </ruby>\n \n-creates seven different routes in your application, all mapping to the +Photos+ controller:\n+creates eight different routes in your application, all mapping to the +Photos+ controller:\n \n |_. HTTP Verb |_.Path |_.action |_.used for |\n |GET |/photos |index |display a list of all photos |\n@@ -82,11 +82,12 @@ creates seven different routes in your application, all mapping to the +Photos+\n |POST |/photos |create |create a new photo |\n |GET |/photos/:id |show |display a specific photo |\n |GET |/photos/:id/edit |edit |return an HTML form for editing a photo |\n+|PATCH |/photos/:id |update |update a specific photo |\n |PUT |/photos/:id |update |update a specific photo |\n |DELETE |/photos/:id |destroy |delete a specific photo |\n \n \n-NOTE: Rails routes are matched in the order they are specified, so if you have a +resources :photos+ above a +get 'photos/poll'+ the +show+ action's route for the +resources+ line will be matched before the +get+ line. To fix this, move the +get+ line *above* the +resources+ line so that it is matched first.\n+NOTE: The default HTTP Verb for the +update+ action is PATCH; PUT is supported for backwards compatibility. Rails routes are matched in the order they are specified, so if you have a +resources :photos+ above a +get 'photos/poll'+ the +show+ action's route for the +resources+ line will be matched before the +get+ line. To fix this, move the +get+ line *above* the +resources+ line so that it is matched first.\n \n h4. Paths and URLs\n \n@@ -131,17 +132,18 @@ This resourceful route\n resource :geocoder\n </ruby>\n \n-creates six different routes in your application, all mapping to the +Geocoders+ controller:\n+creates seven different routes in your application, all mapping to the +Geocoders+ controller:\n \n |_.HTTP Verb |_.Path |_.action |_.used for |\n |GET |/geocoder/new |new |return an HTML form for creating the geocoder |\n |POST |/geocoder |create |create the new geocoder |\n |GET |/geocoder |show |display the one and only geocoder resource |\n |GET |/geocoder/edit |edit |return an HTML form for editing the geocoder |\n+|PATCH |/geocoder |update |update the one and only geocoder resource |\n |PUT |/geocoder |update |update the one and only geocoder resource |\n |DELETE |/geocoder |destroy |delete the geocoder resource |\n \n-NOTE: Because you might want to use the same controller for a singular route (+/account+) and a plural route (+/accounts/45+), singular resources map to plural controllers.\n+NOTE: The default HTTP Verb for the +update+ action is PATCH; PUT is supported for backwards compatibility. Because you might want to use the same controller for a singular route (+/account+) and a plural route (+/accounts/45+), singular resources map to plural controllers.\n \n A singular resourceful route generates these helpers:\n \n@@ -169,6 +171,7 @@ This will create a number of routes for each of the +posts+ and +comments+ contr\n |POST |/admin/posts |create | admin_posts_path |\n |GET |/admin/posts/1 |show | admin_post_path(id) |\n |GET |/admin/posts/1/edit |edit | edit_admin_post_path(id) |\n+|PATCH |/admin/posts/1 |update | admin_post_path(id) |\n |PUT |/admin/posts/1 |update | admin_post_path(id) |\n |DELETE |/admin/posts/1 |destroy | admin_post_path(id) |\n \n@@ -208,6 +211,7 @@ In each of these cases, the named routes remain the same as if you did not use +\n |POST |/admin/posts |create | posts_path |\n |GET |/admin/posts/1 |show | post_path(id) |\n |GET |/admin/posts/1/edit |edit | edit_post_path(id) |\n+|PATCH |/admin/posts/1 |update | post_path(id) |\n |PUT |/admin/posts/1 |update | post_path(id) |\n |DELETE |/admin/posts/1 |destroy | post_path(id) |\n \n@@ -241,6 +245,7 @@ In addition to the routes for magazines, this declaration will also route ads to\n |POST |/magazines/1/ads |create |create a new ad belonging to a specific magazine |\n |GET |/magazines/1/ads/1 |show |display a specific ad belonging to a specific magazine |\n |GET |/magazines/1/ads/1/edit |edit |return an HTML form for editing an ad belonging to a specific magazine |\n+|PATCH |/magazines/1/ads/1 |update |update a specific ad belonging to a specific magazine |\n |PUT |/magazines/1/ads/1 |update |update a specific ad belonging to a specific magazine |\n |DELETE |/magazines/1/ads/1 |destroy |delete a specific ad belonging to a specific magazine |\n \n@@ -323,7 +328,7 @@ end\n \n This will recognize +/photos/1/preview+ with GET, and route to the +preview+ action of +PhotosController+. It will also create the +preview_photo_url+ and +preview_photo_path+ helpers.\n \n-Within the block of member routes, each route name specifies the HTTP verb that it will recognize. You can use +get+, +put+, +post+, or +delete+ here. If you don't have multiple +member+ routes, you can also pass +:on+ to a route, eliminating the block:\n+Within the block of member routes, each route name specifies the HTTP verb that it will recognize. You can use +get+, +patch+, +put+, +post+, or +delete+ here. If you don't have multiple +member+ routes, you can also pass +:on+ to a route, eliminating the block:\n \n <ruby>\n resources :photos do\n@@ -634,6 +639,7 @@ will recognize incoming paths beginning with +/photos+ but route to the +Images+\n |POST |/photos |create | photos_path |\n |GET |/photos/1 |show | photo_path(id) |\n |GET |/photos/1/edit |edit | edit_photo_path(id) |\n+|PATCH |/photos/1 |update | photo_path(id) |\n |PUT |/photos/1 |update | photo_path(id) |\n |DELETE |/photos/1 |destroy | photo_path(id) |\n \n@@ -678,6 +684,7 @@ will recognize incoming paths beginning with +/photos+ and route the requests to\n |POST |/photos |create | images_path |\n |GET |/photos/1 |show | image_path(id) |\n |GET |/photos/1/edit |edit | edit_image_path(id) |\n+|PATCH |/photos/1 |update | image_path(id) |\n |PUT |/photos/1 |update | image_path(id) |\n |DELETE |/photos/1 |destroy | image_path(id) |\n \n@@ -782,6 +789,7 @@ Rails now creates routes to the +CategoriesController+.\n |POST |/kategorien |create | categories_path |\n |GET |/kategorien/1 |show | category_path(id) |\n |GET |/kategorien/1/bearbeiten |edit | edit_category_path(id) |\n+|PATCH |/kategorien/1 |update | category_path(id) |\n |PUT |/kategorien/1 |update | category_path(id) |\n |DELETE |/kategorien/1 |destroy | category_path(id) |\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "d3f62aa385a606e6ad0a09b8ba047ff1b2b56835",
filename = "railties/guides/source/security.textile", status = "modified",
additions = 1L, deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/guides/source/security.textile",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/guides/source/security.textile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/guides/source/security.textile?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -209,7 +209,7 @@ The HTTP protocol basically provides two main types of requests - GET and POST (\n * The interaction _(highlight)changes the state_ of the resource in a way that the user would perceive (e.g., a subscription to a service), or\n * The user is _(highlight)held accountable for the results_ of the interaction.\n \n-If your web application is RESTful, you might be used to additional HTTP verbs, such as PUT or DELETE. Most of today‘s web browsers, however do not support them - only GET and POST. Rails uses a hidden +_method+ field to handle this barrier.\n+If your web application is RESTful, you might be used to additional HTTP verbs, such as PATCH or DELETE. Most of today‘s web browsers, however do not support them - only GET and POST. Rails uses a hidden +_method+ field to handle this barrier.\n \n _(highlight)POST requests can be sent automatically, too_. Here is an example for a link which displays www.harmless.com as destination in the browser's status bar. In fact it dynamically creates a new form that sends a POST request.\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "687ecf1026b193ceed3abfb6533109ee3d54dfd1",
filename = "railties/guides/source/testing.textile", status = "modified",
additions = 4L, deletions = 2L, changes = 6L, blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/guides/source/testing.textile",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/guides/source/testing.textile",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/guides/source/testing.textile?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -490,10 +490,11 @@ Now you can try running all the tests and they should pass.\n \n h4. Available Request Types for Functional Tests\n \n-If you're familiar with the HTTP protocol, you'll know that +get+ is a type of request. There are 5 request types supported in Rails functional tests:\n+If you're familiar with the HTTP protocol, you'll know that +get+ is a type of request. There are 6 request types supported in Rails functional tests:\n \n * +get+\n * +post+\n+* +patch+\n * +put+\n * +head+\n * +delete+\n@@ -645,6 +646,7 @@ In addition to the standard testing helpers, there are some additional helpers a\n |+request_via_redirect(http_method, path, [parameters], [headers])+ |Allows you to make an HTTP request and follow any subsequent redirects.|\n |+post_via_redirect(path, [parameters], [headers])+ |Allows you to make an HTTP POST request and follow any subsequent redirects.|\n |+get_via_redirect(path, [parameters], [headers])+ |Allows you to make an HTTP GET request and follow any subsequent redirects.|\n+|+patch_via_redirect(path, [parameters], [headers])+ |Allows you to make an HTTP PATCH request and follow any subsequent redirects.|\n |+put_via_redirect(path, [parameters], [headers])+ |Allows you to make an HTTP PUT request and follow any subsequent redirects.|\n |+delete_via_redirect(path, [parameters], [headers])+ |Allows you to make an HTTP DELETE request and follow any subsequent redirects.|\n |+open_session+ |Opens a new session instance.|\n@@ -818,7 +820,7 @@ class PostsControllerTest < ActionController::TestCase\n end\n \n test \"should update post\" do\n- put :update, :id => @post.id, :post => { }\n+ patch :update, :id => @post.id, :post => { }\n assert_redirected_to post_path(assigns(:post))\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "170eac4cea3b5ba70b6a696858e7b9ece1c452f6",
filename = "railties/lib/rails/generators/active_model.rb",
status = "modified", additions = 3L, deletions = 3L, changes = 6L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/lib/rails/generators/active_model.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/lib/rails/generators/active_model.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/active_model.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -37,7 +37,7 @@ def self.all(klass)\n \n # GET show\n # GET edit\n- # PUT update\n+ # PATCH update\n # DELETE destroy\n def self.find(klass, params=nil)\n \"#{klass}.find(#{params})\"\n@@ -58,13 +58,13 @@ def save\n \"#{name}.save\"\n end\n \n- # PUT update\n+ # PATCH update\n def update_attributes(params=nil)\n \"#{name}.update_attributes(#{params})\"\n end\n \n # POST create\n- # PUT update\n+ # PATCH update\n def errors\n \"#{name}.errors\"\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "0ae62c73849776cd15d50e8fb0f31135e9c770fc",
filename = "railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb",
status = "modified", additions = 2L, deletions = 2L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb",
raw_url = "https://github.com/rails/rails/raw/d5619a2d9bae75bdc1169f8a7deb8efae3c47072/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb?ref=d5619a2d9bae75bdc1169f8a7deb8efae3c47072",
patch = "@@ -54,8 +54,8 @@ def create\n end\n end\n \n- # PUT <%= route_url %>/1\n- # PUT <%= route_url %>/1.json\n+ # PATCH <%= route_url %>/1\n+ # PATCH <%= route_url %>/1.json\n def update\n @<%= singular_table_name %> = <%= orm_class.find(class_name, \"params[:id]\") %>\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:57 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4603", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 00:24:13 GMT",
etag = "\"ef58e85d451b0e870489e082f42d5b20\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F2489E1:54D90245",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "474556b853193c38f1b14328ce2d1b7d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = FALSE, content = structure(list(
message = "Not Found", documentation_url = "https://developer.github.com/v3"), .Names = c("message",
"documentation_url")), headers = structure(list(server = "GitHub.com",
date = "Mon, 09 Feb 2015 18:53:57 GMT", `content-type` = "application/json; charset=utf-8",
`transfer-encoding` = "chunked", status = "404 Not Found",
`x-ratelimit-limit` = "5000", `x-ratelimit-remaining` = "4602",
`x-ratelimit-reset` = "1423510857", `x-oauth-scopes` = "",
`x-accepted-oauth-scopes` = "", `x-oauth-client-id` = "3f2c05f63b3d9cebf87f",
`x-github-media-type` = "github.v3", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248A09:54D90245",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", `content-encoding` = "gzip"), .Names = c("server",
"date", "content-type", "transfer-encoding", "status", "x-ratelimit-limit",
"x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes",
"x-accepted-oauth-scopes", "x-oauth-client-id", "x-github-media-type",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "content-encoding"), class = c("insensitive",
"list")), code = 404L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = FALSE, content = structure(list(
message = "Not Found", documentation_url = "https://developer.github.com/v3"), .Names = c("message",
"documentation_url")), headers = structure(list(server = "GitHub.com",
date = "Mon, 09 Feb 2015 18:53:57 GMT", `content-type` = "application/json; charset=utf-8",
`transfer-encoding` = "chunked", status = "404 Not Found",
`x-ratelimit-limit` = "5000", `x-ratelimit-remaining` = "4601",
`x-ratelimit-reset` = "1423510857", `x-oauth-scopes` = "",
`x-accepted-oauth-scopes` = "", `x-oauth-client-id` = "3f2c05f63b3d9cebf87f",
`x-github-media-type` = "github.v3", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248A23:54D90245",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", `content-encoding` = "gzip"), .Names = c("server",
"date", "content-type", "transfer-encoding", "status", "x-ratelimit-limit",
"x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes",
"x-accepted-oauth-scopes", "x-oauth-client-id", "x-github-media-type",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "content-encoding"), class = c("insensitive",
"list")), code = 404L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "2b4754827e259bd433752a603918fa8f49b473e7", filename = "activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb",
status = "modified", additions = 8L, deletions = 1L, changes = 9L,
blob_url = "https://github.com/rails/rails/blob/069b19c9b8330e18bb749b2498c4f78aeec896c6/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb",
raw_url = "https://github.com/rails/rails/raw/069b19c9b8330e18bb749b2498c4f78aeec896c6/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb?ref=069b19c9b8330e18bb749b2498c4f78aeec896c6",
patch = "@@ -66,7 +66,14 @@ def self.establish_connection(spec = nil)\n unless spec.key?(:adapter) then raise AdapterNotSpecified, \"database configuration does not specify adapter\" end\n \n begin\n- require \"active_record/connection_adapters/#{spec[:adapter]}_adapter\"\n+ #FIXME\n+ # Need this cause 'activerecord-jdbcmysql-adapter' gem having same file name.\n+ if spec[:adapter] =~ /jdbcmysql|jdbcsqlite3/\n+ require \"active_record/connection_adapters/jdbc_#{spec[:adapter]}_adapter\"\n+ else\n+ require \"active_record/connection_adapters/#{spec[:adapter]}_adapter\"\n+ end\n+\n rescue LoadError => e\n raise \"Please install the #{spec[:adapter]} adapter: `gem install activerecord-#{spec[:adapter]}-adapter` (#{e})\"\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "e9fdb13738506bd6c1f9fbd78e875c04a1147bb0",
filename = "activerecord/lib/active_record/connection_adapters/jdbc_jdbcmysql_adapter.rb",
status = "added", additions = 26L, deletions = 0L, changes = 26L,
blob_url = "https://github.com/rails/rails/blob/069b19c9b8330e18bb749b2498c4f78aeec896c6/activerecord/lib/active_record/connection_adapters/jdbc_jdbcmysql_adapter.rb",
raw_url = "https://github.com/rails/rails/raw/069b19c9b8330e18bb749b2498c4f78aeec896c6/activerecord/lib/active_record/connection_adapters/jdbc_jdbcmysql_adapter.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/connection_adapters/jdbc_jdbcmysql_adapter.rb?ref=069b19c9b8330e18bb749b2498c4f78aeec896c6",
patch = "@@ -0,0 +1,26 @@\n+# encoding: utf-8\n+\n+gem 'activerecord-jdbcmysql-adapter'\n+require 'arjdbc/mysql'\n+\n+module ActiveRecord::ConnectionAdapters\n+\n+ class MysqlAdapter < JdbcAdapter\n+\n+ protected\n+\n+ def exec_insert(sql, name, binds)\n+ binds = binds.dup\n+\n+ # Pretend to support bind parameters\n+ execute sql.gsub('?') { quote(*binds.shift.reverse) }, name\n+ end\n+ alias :exec_update :exec_insert\n+ alias :exec_delete :exec_insert\n+\n+ def last_inserted_id(result)\n+ result\n+ end\n+\n+ end\n+end\n\\ No newline at end of file"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "85d0ee16a0b2bcbf394f3d25fef64c717e37b345",
filename = "activerecord/lib/active_record/connection_adapters/jdbc_jdbcsqlite3_adapter.rb",
status = "added", additions = 14L, deletions = 0L, changes = 14L,
blob_url = "https://github.com/rails/rails/blob/069b19c9b8330e18bb749b2498c4f78aeec896c6/activerecord/lib/active_record/connection_adapters/jdbc_jdbcsqlite3_adapter.rb",
raw_url = "https://github.com/rails/rails/raw/069b19c9b8330e18bb749b2498c4f78aeec896c6/activerecord/lib/active_record/connection_adapters/jdbc_jdbcsqlite3_adapter.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/lib/active_record/connection_adapters/jdbc_jdbcsqlite3_adapter.rb?ref=069b19c9b8330e18bb749b2498c4f78aeec896c6",
patch = "@@ -0,0 +1,14 @@\n+gem 'activerecord-jdbcsqlite3-adapter'\n+require 'arjdbc/sqlite3'\n+\n+module ActiveRecord::ConnectionAdapters\n+ class SQLiteAdapter < JdbcAdapter\n+\n+ protected\n+\n+ def last_inserted_id(result)\n+ last_insert_id\n+ end\n+\n+ end\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:58 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4601", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:59:45 GMT",
etag = "\"dc0d5f458aad7f039b7384c4f644ad74\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248A49:54D90245",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "7f48e2f7761567e923121f17538d7a6d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "a2c4f7bfdadd62cb2880a42804221de81a32ee94", filename = "activesupport/lib/active_support/inflector/methods.rb",
status = "modified", additions = 3L, deletions = 1L, changes = 4L,
blob_url = "https://github.com/rails/rails/blob/91c18554f6f54ae2d4cb7e945d830b75aa0c3b18/activesupport/lib/active_support/inflector/methods.rb",
raw_url = "https://github.com/rails/rails/raw/91c18554f6f54ae2d4cb7e945d830b75aa0c3b18/activesupport/lib/active_support/inflector/methods.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/lib/active_support/inflector/methods.rb?ref=91c18554f6f54ae2d4cb7e945d830b75aa0c3b18",
patch = "@@ -135,6 +135,8 @@ def constantize(camel_cased_word) #:nodoc:\n # ordinalize(2) # => \"2nd\"\n # ordinalize(1002) # => \"1002nd\"\n # ordinalize(1003) # => \"1003rd\"\n+ # ordinalize(-11) # => \"-11th\"\n+ # ordinalize(-1021) # => \"-1021st\"\n def ordinalize(number)\n if (11..13).include?(number.to_i.abs % 100)\n \"#{number}th\"\n@@ -148,4 +150,4 @@ def ordinalize(number)\n end\n end\n end\n-end\n\\ No newline at end of file\n+end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:58 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4601", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 02 Feb 2015 20:27:19 GMT",
etag = "\"046b8c82082ac71bdd4cac8ef2c234e8\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248A70:54D90246",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "d594a23ec74671eba905bf91ef329026"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "ca8973f00137a846308c27e25cc01c06b77f3ca5", filename = "activesupport/CHANGELOG",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/1021b51b4fe0d3199427a1cf4528c81f9fda08e8/activesupport/CHANGELOG",
raw_url = "https://github.com/rails/rails/raw/1021b51b4fe0d3199427a1cf4528c81f9fda08e8/activesupport/CHANGELOG",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/CHANGELOG?ref=1021b51b4fe0d3199427a1cf4528c81f9fda08e8",
patch = "@@ -19,7 +19,7 @@ advantage of the new ClassCache.\n \n * Added before_remove_const callback to ActiveSupport::Dependencies.remove_unloadable_constants! [Andrew White]\n \n-*Rails 3.0.2 (unreleased)*\n+*Rails 3.0.2 (November 15, 2010)*\n \n * Added before_remove_const callback to ActiveSupport::Dependencies.remove_unloadable_constants! [Andrew White]\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:58 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4601", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 15:22:58 GMT",
etag = "\"e59379621a7eed4eab1ac4e7a6e7a5fb\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248A8D:54D90246",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "dc1ce2bfb41810a06c705e83b388572d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = FALSE, content = structure(list(
message = "Not Found", documentation_url = "https://developer.github.com/v3"), .Names = c("message",
"documentation_url")), headers = structure(list(server = "GitHub.com",
date = "Mon, 09 Feb 2015 18:53:58 GMT", `content-type` = "application/json; charset=utf-8",
`transfer-encoding` = "chunked", status = "404 Not Found",
`x-ratelimit-limit` = "5000", `x-ratelimit-remaining` = "4600",
`x-ratelimit-reset` = "1423510857", `x-oauth-scopes` = "",
`x-accepted-oauth-scopes` = "", `x-oauth-client-id` = "3f2c05f63b3d9cebf87f",
`x-github-media-type` = "github.v3", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248AAE:54D90246",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", `content-encoding` = "gzip"), .Names = c("server",
"date", "content-type", "transfer-encoding", "status", "x-ratelimit-limit",
"x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes",
"x-accepted-oauth-scopes", "x-oauth-client-id", "x-github-media-type",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "content-encoding"), class = c("insensitive",
"list")), code = 404L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = FALSE, content = structure(list(
message = "Not Found", documentation_url = "https://developer.github.com/v3"), .Names = c("message",
"documentation_url")), headers = structure(list(server = "GitHub.com",
date = "Mon, 09 Feb 2015 18:53:58 GMT", `content-type` = "application/json; charset=utf-8",
`transfer-encoding` = "chunked", status = "404 Not Found",
`x-ratelimit-limit` = "5000", `x-ratelimit-remaining` = "4599",
`x-ratelimit-reset` = "1423510857", `x-oauth-scopes` = "",
`x-accepted-oauth-scopes` = "", `x-oauth-client-id` = "3f2c05f63b3d9cebf87f",
`x-github-media-type` = "github.v3", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248AC8:54D90246",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", `content-encoding` = "gzip"), .Names = c("server",
"date", "content-type", "transfer-encoding", "status", "x-ratelimit-limit",
"x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes",
"x-accepted-oauth-scopes", "x-oauth-client-id", "x-github-media-type",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "content-encoding"), class = c("insensitive",
"list")), code = 404L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = FALSE, content = structure(list(
message = "Not Found", documentation_url = "https://developer.github.com/v3"), .Names = c("message",
"documentation_url")), headers = structure(list(server = "GitHub.com",
date = "Mon, 09 Feb 2015 18:53:58 GMT", `content-type` = "application/json; charset=utf-8",
`transfer-encoding` = "chunked", status = "404 Not Found",
`x-ratelimit-limit` = "5000", `x-ratelimit-remaining` = "4598",
`x-ratelimit-reset` = "1423510857", `x-oauth-scopes` = "",
`x-accepted-oauth-scopes` = "", `x-oauth-client-id` = "3f2c05f63b3d9cebf87f",
`x-github-media-type` = "github.v3", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248AE3:54D90246",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", `content-encoding` = "gzip"), .Names = c("server",
"date", "content-type", "transfer-encoding", "status", "x-ratelimit-limit",
"x-ratelimit-remaining", "x-ratelimit-reset", "x-oauth-scopes",
"x-accepted-oauth-scopes", "x-oauth-client-id", "x-github-media-type",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "content-encoding"), class = c("insensitive",
"list")), code = 404L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "8bb15e849a178d70d505ce93d4df2c552e3dc591", filename = "activesupport/README.rdoc",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/8265c45db31074086fd7422d59af533224adba78/activesupport/README.rdoc",
raw_url = "https://github.com/rails/rails/raw/8265c45db31074086fd7422d59af533224adba78/activesupport/README.rdoc",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/README.rdoc?ref=8265c45db31074086fd7422d59af533224adba78",
patch = "@@ -30,4 +30,4 @@ API documentation is at\n \n Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here:\n \n-* https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets\n+* https://github.com/rails/rails/issues"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:58 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4598", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 02 Feb 2015 20:27:19 GMT",
etag = "\"f527912d51450e8c3c39b4194a42cdf8\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248B03:54D90246",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "318e55760cf7cdb40e61175a4d36cd32"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "d4475bc9515af8749f1ff518353a32ccd68d3c1c", filename = "actionmailer/CHANGELOG",
status = "modified", additions = 29L, deletions = 1L, changes = 30L,
blob_url = "https://github.com/rails/rails/blob/259c749de19c8217c7a1de808e5e2034d5bff995/actionmailer/CHANGELOG",
raw_url = "https://github.com/rails/rails/raw/259c749de19c8217c7a1de808e5e2034d5bff995/actionmailer/CHANGELOG",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionmailer/CHANGELOG?ref=259c749de19c8217c7a1de808e5e2034d5bff995",
patch = "@@ -2,14 +2,42 @@\n \n * No changes\n \n-*Rails 3.0.2 (unreleased)*\n+\n+*Rails 3.0.7 (April 18, 2011)*\n+\n+* remove AM delegating register_observer and register_interceptor to Mail [Josh Kalderimis]\n+\n+\n+*Rails 3.0.6 (April 5, 2011)\n+\n+* Don't allow i18n to change the minor version, version now set to ~> 0.5.0 [Santiago Pastorino]\n+\n+\n+*Rails 3.0.5 (February 26, 2011)*\n+\n+* No changes.\n+\n+\n+*Rails 3.0.4 (February 8, 2011)*\n+\n+* No changes.\n+\n+\n+*Rails 3.0.3 (November 16, 2010)*\n+\n+* No changes.\n+\n+\n+*Rails 3.0.2 (November 15, 2010)*\n \n * No changes\n \n+\n *Rails 3.0.1 (October 15, 2010)*\n \n * No Changes, just a version bump.\n \n+\n *Rails 3.0.0 (August 29, 2010)*\n \n * subject is automatically looked up on I18n using mailer_name and action_name as scope as in t(\".subject\") [JK]"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "68076b794e60ba243da3b6987571f1aa6c997bf0",
filename = "actionpack/CHANGELOG", status = "modified", additions = 52L,
deletions = 1L, changes = 53L, blob_url = "https://github.com/rails/rails/blob/259c749de19c8217c7a1de808e5e2034d5bff995/actionpack/CHANGELOG",
raw_url = "https://github.com/rails/rails/raw/259c749de19c8217c7a1de808e5e2034d5bff995/actionpack/CHANGELOG",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/CHANGELOG?ref=259c749de19c8217c7a1de808e5e2034d5bff995",
patch = "@@ -133,7 +133,58 @@ tested.\n * Add Rack::Cache to the default stack. Create a Rails store that delegates to the Rails cache, so by default, whatever caching layer you are using will be used for HTTP caching. Note that Rack::Cache will be used if you use #expires_in, #fresh_when or #stale with :public => true. Otherwise, the caching rules will apply to the browser only. [Yehuda Katz, Carl Lerche]\n \n \n-*Rails 3.0.2 (unreleased)*\n+*Rails 3.0.7 (April 18, 2011)*\n+\n+*No changes.\n+\n+\n+*Rails 3.0.6 (April 5, 2011)\n+\n+* Fixed XSS vulnerability in `auto_link`. `auto_link` no longer marks input as\n+ html safe. Please make sure that calls to auto_link() are wrapped in a\n+ sanitize(), or a raw() depending on the type of input passed to auto_link().\n+ For example:\n+\n+ <%= sanitize(auto_link(some_user_input)) %>\n+\n+ Thanks to Torben Schulz for reporting this. The fix can be found here:\n+ 61ee3449674c591747db95f9b3472c5c3bd9e84d\n+\n+* Fixes the output of `rake routes` to be correctly match to the behavior of the application, as the regular expression used to match the path is greedy and won't capture the format part by default [Prem Sichanugrist]\n+\n+* Fixes an issue with number_to_human when converting values which are less than 1 but greater than -1 [Josh Kalderimis]\n+\n+* Sensitive query string parameters (specified in config.filter_parameters) will now be filtered out from the request paths in the log file. [Prem Sichanugrist, fxn]\n+\n+* URL parameters which return nil for to_param are now removed from the query string [Andrew White]\n+\n+* Don't allow i18n to change the minor version, version now set to ~> 0.5.0 [Santiago Pastorino]\n+\n+* Make TranslationHelper#translate use the :rescue_format option in I18n 0.5.0 [Sven Fuchs]\n+\n+* Fix regression: javascript_include_tag shouldn't raise if you register an expansion key with nil or [] value [Santiago Pastorino]\n+\n+* Fix Action caching bug where an action that has a non-cacheable response always renders a nil response body. It now correctly renders the response body. [Cheah Chu Yeow]\n+\n+\n+*Rails 3.0.5 (February 26, 2011)*\n+\n+* No changes.\n+\n+\n+*Rails 3.0.4 (February 8, 2011)*\n+\n+* No changes.\n+\n+\n+*Rails 3.0.3 (November 16, 2010)*\n+\n+* When ActiveRecord::Base objects are sent to predicate methods, the id of the object should be sent to ARel, not the ActiveRecord::Base object.\n+\n+* :constraints routing should only do sanity checks against regular expressions. String arguments are OK.\n+\n+\n+*Rails 3.0.2 (November 15, 2010)*\n \n * The helper number_to_currency accepts a new :negative_format option to be able to configure how to render negative amounts. [Don Wilson]\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "be4de2e53cbb61199a7ea2188e2103741090ab91",
filename = "activemodel/CHANGELOG", status = "modified",
additions = 30L, deletions = 1L, changes = 31L, blob_url = "https://github.com/rails/rails/blob/259c749de19c8217c7a1de808e5e2034d5bff995/activemodel/CHANGELOG",
raw_url = "https://github.com/rails/rails/raw/259c749de19c8217c7a1de808e5e2034d5bff995/activemodel/CHANGELOG",
contents_url = "https://api.github.com/repos/rails/rails/contents/activemodel/CHANGELOG?ref=259c749de19c8217c7a1de808e5e2034d5bff995",
patch = "@@ -18,7 +18,36 @@\n * Add support for selectively enabling/disabling observers [Myron Marston]\n \n \n-*Rails 3.0.2 (unreleased)*\n+*Rails 3.0.7 (April 18, 2011)*\n+\n+*No changes.\n+\n+\n+*Rails 3.0.6 (April 5, 2011)\n+\n+* Fix when database column name has some symbolic characters (e.g. Oracle CASE# VARCHAR2(20)) #5818 #6850 [Robert Pankowecki, Santiago Pastorino]\n+\n+* Fix length validation for fixnums #6556 [Andriy Tyurnikov]\n+\n+* Fix i18n key collision with namespaced models #6448 [yves.senn]\n+\n+\n+*Rails 3.0.5 (February 26, 2011)*\n+\n+* No changes.\n+\n+\n+*Rails 3.0.4 (February 8, 2011)*\n+\n+* No changes.\n+\n+\n+*Rails 3.0.3 (November 16, 2010)*\n+\n+* No changes.\n+\n+\n+*Rails 3.0.2 (November 15, 2010)*\n \n * No changes\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "f3692f8299ea3141f31ad9cf749d0d7fb2ab6b80",
filename = "activerecord/CHANGELOG", status = "modified",
additions = 80L, deletions = 0L, changes = 80L, blob_url = "https://github.com/rails/rails/blob/259c749de19c8217c7a1de808e5e2034d5bff995/activerecord/CHANGELOG",
raw_url = "https://github.com/rails/rails/raw/259c749de19c8217c7a1de808e5e2034d5bff995/activerecord/CHANGELOG",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/CHANGELOG?ref=259c749de19c8217c7a1de808e5e2034d5bff995",
patch = "@@ -290,6 +290,84 @@ IrreversibleMigration exception will be raised when going down.\n [Aaron Patterson]\n \n \n+*Rails 3.0.7 (April 18, 2011)*\n+\n+* Destroying records via nested attributes works independent of reject_if LH #6006 [Durran Jordan]\n+\n+* Delegate any? and many? to Model.scoped for consistency [Andrew White]\n+\n+* Quote the ORDER BY clause in batched finds - fixes #6620 [Andrew White]\n+\n+* Change exists? so records are not instantiated - fixes #6127. This prevents after_find\n+ and after_initialize callbacks being triggered when checking for record existence.\n+ [Andrew White]\n+\n+* Fix performance bug with attribute accessors which only occurred on Ruby 1.8.7, and ensure we\n+ cache type-casted values when the column returned from the db contains non-standard chars.\n+ [Jon Leighton]\n+\n+* Fix a performance regression introduced here 86acbf1cc050c8fa8c74a10c735e467fb6fd7df8\n+ related to read_attribute method [Stian Grytøyr]\n+\n+\n+*Rails 3.0.6 (April 5, 2011)*\n+\n+* Un-deprecate reorder method [Sebastian Martinez]\n+\n+* Extensions are applied when calling +except+ or +only+ on relations.\n+ Thanks to Iain Hecker.\n+\n+* Schemas set in set_table_name are respected by the mysql adapter. LH #5322\n+\n+* Fixed a bug when empty? was called on a grouped Relation that wasn't loaded.\n+ LH #5829\n+\n+* Reapply extensions when using except and only. Thanks Iain Hecker.\n+\n+* Binary data is escaped when being inserted to SQLite3 Databases. Thanks\n+ Naruse!\n+\n+\n+*Rails 3.0.5 (February 26, 2011)*\n+\n+* Model.where(:column => 1).where(:column => 2) will always produce an AND\n+query.\n+\n+ [Aaron Patterson]\n+\n+* Deprecated support for interpolated association conditions in the form of :conditions => 'foo = #{bar}'.\n+\n+ Instead, you should use a proc, like so:\n+\n+ Before:\n+\n+ has_many :things, :conditions => 'foo = #{bar}'\n+\n+ After:\n+\n+ has_many :things, :conditions => proc { \"foo = #{bar}\" }\n+\n+ Inside the proc, 'self' is the object which is the owner of the association, unless you are\n+ eager loading the association, in which case 'self' is the class which the association is within.\n+\n+ You can have any \"normal\" conditions inside the proc, so the following will work too:\n+\n+ has_many :things, :conditions => proc { [\"foo = ?\", bar] }\n+\n+ Previously :insert_sql and :delete_sql on has_and_belongs_to_many association allowed you to call\n+ 'record' to get the record being inserted or deleted. This is now passed as an argument to\n+ the proc.\n+\n+ [Jon Leighton]\n+\n+\n+*Rails 3.0.4 (February 8, 2011)*\n+\n+* Added deprecation warning for has_and_belongs_to_many associations where the join table has\n+ additional attributes other than the keys. Access to these attributes is removed in 3.1.\n+ Please use has_many :through instead. [Jon Leighton]\n+\n+\n *Rails 3.0.3 (November 16, 2010)*\n \n * Support find by class like this: Post.where(:name => Post)\n@@ -326,10 +404,12 @@ IrreversibleMigration exception will be raised when going down.\n \n [Aaron Patterson]\n \n+\n *Rails 3.0.1 (October 15, 2010)*\n \n * Introduce a fix for CVE-2010-3993\n \n+\n *Rails 3.0.0 (August 29, 2010)*\n \n * Changed update_attribute to not run callbacks and update the record directly in the database [Neeraj Singh]"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "a4e79f3d7786e8c4c643d8466d66b1488b65a1ef",
filename = "activeresource/CHANGELOG", status = "modified",
additions = 29L, deletions = 1L, changes = 30L, blob_url = "https://github.com/rails/rails/blob/259c749de19c8217c7a1de808e5e2034d5bff995/activeresource/CHANGELOG",
raw_url = "https://github.com/rails/rails/raw/259c749de19c8217c7a1de808e5e2034d5bff995/activeresource/CHANGELOG",
contents_url = "https://api.github.com/repos/rails/rails/contents/activeresource/CHANGELOG?ref=259c749de19c8217c7a1de808e5e2034d5bff995",
patch = "@@ -2,14 +2,42 @@\n \n * No changes\n \n-*Rails 3.0.2 (unreleased)*\n+\n+*Rails 3.0.7 (April 18, 2011)*\n+\n+*No changes.\n+\n+\n+*Rails 3.0.6 (April 5, 2011)\n+\n+* No changes.\n+\n+\n+*Rails 3.0.5 (February 26, 2011)*\n+\n+* No changes.\n+\n+\n+*Rails 3.0.4 (February 8, 2011)*\n+\n+* No changes.\n+\n+\n+*Rails 3.0.3 (November 16, 2010)*\n+\n+* No changes.\n+\n+\n+*Rails 3.0.2 (November 15, 2010)*\n \n * No changes\n \n+\n *Rails 3.0.1 (October 15, 2010)*\n \n * No Changes, just a version bump.\n \n+\n *Rails 3.0.0 (August 29, 2010)*\n \n * JSON: set Base.include_root_in_json = true to include a root value in the JSON: {\"post\": {\"title\": ...}}. Mirrors the Active Record option. [Santiago Pastorino]"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "feff37cddf37f1673ed128705c251ebe7259c0e6",
filename = "activesupport/CHANGELOG", status = "modified",
additions = 28L, deletions = 0L, changes = 28L, blob_url = "https://github.com/rails/rails/blob/259c749de19c8217c7a1de808e5e2034d5bff995/activesupport/CHANGELOG",
raw_url = "https://github.com/rails/rails/raw/259c749de19c8217c7a1de808e5e2034d5bff995/activesupport/CHANGELOG",
contents_url = "https://api.github.com/repos/rails/rails/contents/activesupport/CHANGELOG?ref=259c749de19c8217c7a1de808e5e2034d5bff995",
patch = "@@ -19,14 +19,42 @@ advantage of the new ClassCache.\n \n * Added before_remove_const callback to ActiveSupport::Dependencies.remove_unloadable_constants! [Andrew White]\n \n+\n+*Rails 3.0.7 (April 18, 2011)*\n+\n+* Hash.from_xml no longer loses attributes on tags containing only whitespace [André Arko]\n+\n+\n+*Rails 3.0.6 (April 5, 2011)\n+\n+* No changes.\n+\n+\n+*Rails 3.0.5 (February 26, 2011)*\n+\n+* No changes.\n+\n+\n+*Rails 3.0.4 (February 8, 2011)*\n+\n+* No changes.\n+\n+\n+*Rails 3.0.3 (November 16, 2010)*\n+\n+* No changes.\n+\n+\n *Rails 3.0.2 (November 15, 2010)*\n \n * Added before_remove_const callback to ActiveSupport::Dependencies.remove_unloadable_constants! [Andrew White]\n \n+\n *Rails 3.0.1 (October 15, 2010)*\n \n * No Changes, just a version bump.\n \n+\n *Rails 3.0.0 (August 29, 2010)*\n \n * Implemented String#strip_heredoc. [fxn]"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "e058b624b5f797080358fa7f8493bce73ea6c10b",
filename = "railties/CHANGELOG", status = "modified", additions = 32L,
deletions = 0L, changes = 32L, blob_url = "https://github.com/rails/rails/blob/259c749de19c8217c7a1de808e5e2034d5bff995/railties/CHANGELOG",
raw_url = "https://github.com/rails/rails/raw/259c749de19c8217c7a1de808e5e2034d5bff995/railties/CHANGELOG",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/CHANGELOG?ref=259c749de19c8217c7a1de808e5e2034d5bff995",
patch = "@@ -74,10 +74,42 @@ by the prototype-rails gem. [fxn]\n \n * Include all helpers from plugins and shared engines in application [Piotr Sarnacki]\n \n+\n+*Rails 3.0.7 (April 18, 2011)*\n+\n+*No changes.\n+\n+\n+*Rails 3.0.6 (April 5, 2011)\n+\n+* No changes.\n+\n+\n+*Rails 3.0.5 (February 26, 2011)*\n+\n+* No changes.\n+\n+\n+*Rails 3.0.4 (February 8, 2011)*\n+\n+* No changes.\n+\n+\n+*Rails 3.0.3 (November 16, 2010)*\n+\n+* No changes.\n+\n+\n+*Rails 3.0.2 (November 15, 2010)*\n+\n+* No changes.\n+\n+\n *Rails 3.0.1 (October 15, 2010)*\n \n * No Changes, just a version bump.\n \n+\n *Rails 3.0.0 (August 29, 2010)*\n \n * Application generation: --skip-testunit and --skip-activerecord become --skip-test-unit and --skip-active-record respectively. [fxn]"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:58 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4598", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 15:22:58 GMT",
etag = "\"107fd385ba19571bb4d9d3c29415b8d4\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248B1D:54D90246",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "7f48e2f7761567e923121f17538d7a6d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "97be5a5bb07cdfce69a9b58cd79cbf7fd8383504", filename = "actionpack/test/activerecord/render_partial_with_record_identification_test.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/33f0b6b67d640168c2699659c4a6aa2113b635b7/actionpack/test/activerecord/render_partial_with_record_identification_test.rb",
raw_url = "https://github.com/rails/rails/raw/33f0b6b67d640168c2699659c4a6aa2113b635b7/actionpack/test/activerecord/render_partial_with_record_identification_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/activerecord/render_partial_with_record_identification_test.rb?ref=33f0b6b67d640168c2699659c4a6aa2113b635b7",
patch = "@@ -36,7 +36,7 @@ def render_with_record\n end\n \n def render_with_record_collection\n- @developers = Developer.find(:all)\n+ @developers = Developer.all\n render :partial => @developers\n end\n "), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "49d82ba2dfae7dd51b0db797abd8f1baa56bf23b",
filename = "activerecord/test/cases/associations_test.rb",
status = "modified", additions = 1L, deletions = 1L, changes = 2L,
blob_url = "https://github.com/rails/rails/blob/33f0b6b67d640168c2699659c4a6aa2113b635b7/activerecord/test/cases/associations_test.rb",
raw_url = "https://github.com/rails/rails/raw/33f0b6b67d640168c2699659c4a6aa2113b635b7/activerecord/test/cases/associations_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/associations_test.rb?ref=33f0b6b67d640168c2699659c4a6aa2113b635b7",
patch = "@@ -85,7 +85,7 @@ def test_bad_collection_keys\n \n def test_should_construct_new_finder_sql_after_create\n person = Person.new :first_name => 'clark'\n- assert_equal [], person.readers.find(:all)\n+ assert_equal [], person.readers.all\n person.save!\n reader = Reader.create! :person => person, :post => Post.new(:title => \"foo\", :body => \"bar\")\n assert person.readers.find(reader.id)"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "fb4eacb6324e38384402f515d4e2384153fbf6f5",
filename = "activerecord/test/cases/base_test.rb", status = "modified",
additions = 1L, deletions = 1L, changes = 2L, blob_url = "https://github.com/rails/rails/blob/33f0b6b67d640168c2699659c4a6aa2113b635b7/activerecord/test/cases/base_test.rb",
raw_url = "https://github.com/rails/rails/raw/33f0b6b67d640168c2699659c4a6aa2113b635b7/activerecord/test/cases/base_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/base_test.rb?ref=33f0b6b67d640168c2699659c4a6aa2113b635b7",
patch = "@@ -105,7 +105,7 @@ def test_limit_should_allow_sql_literal\n \n def test_select_symbol\n topic_ids = Topic.select(:id).map(&:id).sort\n- assert_equal Topic.find(:all).map(&:id).sort, topic_ids\n+ assert_equal Topic.all.map(&:id).sort, topic_ids\n end\n \n def test_table_exists"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:59 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4598", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Thu, 05 Feb 2015 17:43:29 GMT",
etag = "\"ba635456513f26b51e14b67cd420cd84\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248B4A:54D90246",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "d594a23ec74671eba905bf91ef329026"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "a0cb5dbdc57142c2de917dcc48f4a8e3dbf25e25", filename = "activerecord/test/cases/method_scoping_test.rb",
status = "modified", additions = 11L, deletions = 11L, changes = 22L,
blob_url = "https://github.com/rails/rails/blob/9a0e3d44d118240d4e7f4049bcfedf0c14771b9b/activerecord/test/cases/method_scoping_test.rb",
raw_url = "https://github.com/rails/rails/raw/9a0e3d44d118240d4e7f4049bcfedf0c14771b9b/activerecord/test/cases/method_scoping_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/activerecord/test/cases/method_scoping_test.rb?ref=9a0e3d44d118240d4e7f4049bcfedf0c14771b9b",
patch = "@@ -68,7 +68,7 @@ def test_scoped_find_combines_and_sanitizes_conditions\n \n def test_scoped_find_all\n Developer.send(:with_scope, :find => { :conditions => \"name = 'David'\" }) do\n- assert_equal [developers(:david)], Developer.find(:all)\n+ assert_equal [developers(:david)], Developer.all\n end\n end\n \n@@ -235,23 +235,23 @@ def test_scoped_create_with_join_and_merge\n def test_immutable_scope\n options = { :conditions => \"name = 'David'\" }\n Developer.send(:with_scope, :find => options) do\n- assert_equal %w(David), Developer.find(:all).map { |d| d.name }\n+ assert_equal %w(David), Developer.all.map(&:name)\n options[:conditions] = \"name != 'David'\"\n- assert_equal %w(David), Developer.find(:all).map { |d| d.name }\n+ assert_equal %w(David), Developer.all.map(&:name)\n end\n \n scope = { :find => { :conditions => \"name = 'David'\" }}\n Developer.send(:with_scope, scope) do\n- assert_equal %w(David), Developer.find(:all).map { |d| d.name }\n+ assert_equal %w(David), Developer.all.map(&:name)\n scope[:find][:conditions] = \"name != 'David'\"\n- assert_equal %w(David), Developer.find(:all).map { |d| d.name }\n+ assert_equal %w(David), Developer.all.map(&:name)\n end\n end\n \n def test_scoped_with_duck_typing\n scoping = Struct.new(:current_scope).new(:find => { :conditions => [\"name = ?\", 'David'] })\n Developer.send(:with_scope, scoping) do\n- assert_equal %w(David), Developer.find(:all).map { |d| d.name }\n+ assert_equal %w(David), Developer.all.map(&:name)\n end\n end\n \n@@ -432,7 +432,7 @@ def test_nested_scoped_find_combines_and_sanitizes_conditions\n def test_merged_scoped_find_combines_and_sanitizes_conditions\n Developer.send(:with_scope, :find => { :conditions => [\"name = ?\", 'David'] }) do\n Developer.send(:with_scope, :find => { :conditions => ['salary > ?', 9000] }) do\n- assert_equal %w(David), Developer.find(:all).map { |d| d.name }\n+ assert_equal %w(David), Developer.all.map(&:name)\n end\n end\n end\n@@ -487,9 +487,9 @@ def test_immutable_nested_scope\n options2 = { :conditions => \"name = 'David'\" }\n Developer.send(:with_scope, :find => options1) do\n Developer.send(:with_exclusive_scope, :find => options2) do\n- assert_equal %w(David), Developer.find(:all).map { |d| d.name }\n+ assert_equal %w(David), Developer.all.map(&:name)\n options1[:conditions] = options2[:conditions] = nil\n- assert_equal %w(David), Developer.find(:all).map { |d| d.name }\n+ assert_equal %w(David), Developer.all.map(&:name)\n end\n end\n end\n@@ -499,9 +499,9 @@ def test_immutable_merged_scope\n options2 = { :conditions => \"salary > 10000\" }\n Developer.send(:with_scope, :find => options1) do\n Developer.send(:with_scope, :find => options2) do\n- assert_equal %w(Jamis), Developer.find(:all).map { |d| d.name }\n+ assert_equal %w(Jamis), Developer.all.map(&:name)\n options1[:conditions] = options2[:conditions] = nil\n- assert_equal %w(Jamis), Developer.find(:all).map { |d| d.name }\n+ assert_equal %w(Jamis), Developer.all.map(&:name)\n end\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:59 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4598", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Thu, 05 Feb 2015 17:43:29 GMT",
etag = "\"2d58df804c5342ed6a45c751c8fe764a\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248B78:54D90247",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "2811da37fbdda4367181b328b22b2499"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "a2814d17fed56d9b557f6f03d71b462e06de4b25", filename = "actionpack/lib/action_controller/caching/pages.rb",
status = "modified", additions = 30L, deletions = 2L, changes = 32L,
blob_url = "https://github.com/rails/rails/blob/3928aca3661b35bfc538d937072d69377a0109ff/actionpack/lib/action_controller/caching/pages.rb",
raw_url = "https://github.com/rails/rails/raw/3928aca3661b35bfc538d937072d69377a0109ff/actionpack/lib/action_controller/caching/pages.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/lib/action_controller/caching/pages.rb?ref=3928aca3661b35bfc538d937072d69377a0109ff",
patch = "@@ -75,8 +75,7 @@ def cache_page(content, path, extension = nil)\n path = page_cache_path(path, extension)\n \n instrument_page_cache :write_page, path do\n- FileUtils.makedirs(File.dirname(path))\n- File.open(path, \"wb+\") { |f| f.write(content) }\n+ with_locked_file(path) { |f| f.write(content) }\n end\n end\n \n@@ -105,6 +104,21 @@ def page_cache_file(path, extension)\n return name\n end\n \n+ def with_locked_file(path)\n+ lock_filename = \"#{path}.lock\"\n+ FileUtils.makedirs(File.dirname(lock_filename))\n+ begin\n+ File.open(lock_filename, \"w+\") do |lf|\n+ lf.flock File::LOCK_EX\n+ ActionController::Caching::Pages::FileMutexes.with_mutex_for_path(path) do\n+ File.open(path, \"wb+\") {|f| yield f }\n+ end\n+ end\n+ ensure\n+ FileUtils.rm lock_filename\n+ end\n+ end\n+\n def page_cache_path(path, extension = nil)\n page_cache_directory.to_s + page_cache_file(path, extension)\n end\n@@ -154,6 +168,20 @@ def cache_page(content = nil, options = nil)\n self.class.cache_page(content || response.body, path, extension)\n end\n \n+ module FileMutexes\n+ extend self\n+ attr_accessor :global_mutex, :file_mutexes\n+ self.global_mutex = Mutex.new\n+ self.file_mutexes = {}\n+\n+ def with_mutex_for_path(path)\n+ mutex = global_mutex.synchronize do\n+ file_mutexes[path] ||= Mutex.new\n+ end\n+\n+ mutex.synchronize { yield }\n+ end\n+ end\n end\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch"))), headers = structure(list(
server = "GitHub.com", date = "Mon, 09 Feb 2015 18:53:59 GMT",
status = "304 Not Modified", `x-ratelimit-limit` = "5000",
`x-ratelimit-remaining` = "4598", `x-ratelimit-reset` = "1423510857",
`cache-control` = "private, max-age=60, s-maxage=60", `last-modified` = "Mon, 09 Feb 2015 13:09:16 GMT",
etag = "\"eaba1884c5886073cec7d145fe591cd9\"", `x-xss-protection` = "1; mode=block",
`x-frame-options` = "deny", `content-security-policy` = "default-src 'none'",
`access-control-allow-credentials` = "true", `access-control-expose-headers` = "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
`access-control-allow-origin` = "*", `x-github-request-id` = "811658B6:2BF1:F248BAA:54D90247",
`strict-transport-security` = "max-age=31536000; includeSubdomains; preload",
`x-content-type-options` = "nosniff", vary = "Accept-Encoding",
`x-served-by` = "dc1ce2bfb41810a06c705e83b388572d"), .Names = c("server",
"date", "status", "x-ratelimit-limit", "x-ratelimit-remaining",
"x-ratelimit-reset", "cache-control", "last-modified", "etag",
"x-xss-protection", "x-frame-options", "content-security-policy",
"access-control-allow-credentials", "access-control-expose-headers",
"access-control-allow-origin", "x-github-request-id", "strict-transport-security",
"x-content-type-options", "vary", "x-served-by"), class = c("insensitive",
"list")), code = 304L), .Names = c("ok", "content", "headers",
"code")), structure(list(ok = TRUE, content = list(structure(list(
sha = "dea80ed887338f2a7e896e59893016b0da607cfe", filename = "actionpack/test/controller/request_forgery_protection_test.rb",
status = "modified", additions = 18L, deletions = 7L, changes = 25L,
blob_url = "https://github.com/rails/rails/blob/8366cabd652a5fbb56fc0942614fbc965e7e45ed/actionpack/test/controller/request_forgery_protection_test.rb",
raw_url = "https://github.com/rails/rails/raw/8366cabd652a5fbb56fc0942614fbc965e7e45ed/actionpack/test/controller/request_forgery_protection_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/actionpack/test/controller/request_forgery_protection_test.rb?ref=8366cabd652a5fbb56fc0942614fbc965e7e45ed",
patch = "@@ -81,22 +81,25 @@ def setup\n @token = \"cf50faa3fe97702ca1ae\"\n \n ActiveSupport::SecureRandom.stubs(:base64).returns(@token)\n- ActionController::Base.request_forgery_protection_token = :authenticity_token\n+ ActionController::Base.request_forgery_protection_token = :custom_authenticity_token\n end\n \n+ def teardown\n+ ActionController::Base.request_forgery_protection_token = nil\n+ end\n \n def test_should_render_form_with_token_tag\n assert_not_blocked do\n get :index\n end\n- assert_select 'form>div>input[name=?][value=?]', 'authenticity_token', @token\n+ assert_select 'form>div>input[name=?][value=?]', 'custom_authenticity_token', @token\n end\n \n def test_should_render_button_to_with_token_tag\n assert_not_blocked do\n get :show_button\n end\n- assert_select 'form>div>input[name=?][value=?]', 'authenticity_token', @token\n+ assert_select 'form>div>input[name=?][value=?]', 'custom_authenticity_token', @token\n end\n \n def test_should_allow_get\n@@ -128,15 +131,15 @@ def test_should_not_allow_xhr_post_without_token\n end\n \n def test_should_allow_post_with_token\n- assert_not_blocked { post :index, :authenticity_token => @token }\n+ assert_not_blocked { post :index, :custom_authenticity_token => @token }\n end\n \n def test_should_allow_put_with_token\n- assert_not_blocked { put :index, :authenticity_token => @token }\n+ assert_not_blocked { put :index, :custom_authenticity_token => @token }\n end\n \n def test_should_allow_delete_with_token\n- assert_not_blocked { delete :index, :authenticity_token => @token }\n+ assert_not_blocked { delete :index, :custom_authenticity_token => @token }\n end\n \n def test_should_allow_post_with_token_in_header\n@@ -172,10 +175,18 @@ def assert_not_blocked\n class RequestForgeryProtectionControllerTest < ActionController::TestCase\n include RequestForgeryProtectionTests\n \n+ setup do\n+ ActionController::Base.request_forgery_protection_token = :custom_authenticity_token\n+ end\n+\n+ teardown do\n+ ActionController::Base.request_forgery_protection_token = nil\n+ end\n+\n test 'should emit a csrf-param meta tag and a csrf-token meta tag' do\n ActiveSupport::SecureRandom.stubs(:base64).returns(@token + '<=?')\n get :meta\n- assert_select 'meta[name=?][content=?]', 'csrf-param', 'authenticity_token'\n+ assert_select 'meta[name=?][content=?]', 'csrf-param', 'custom_authenticity_token'\n assert_select 'meta[name=?][content=?]', 'csrf-token', 'cf50faa3fe97702ca1ae&lt;=?'\n end\n end"), .Names = c("sha",
"filename", "status", "additions", "deletions", "changes", "blob_url",
"raw_url", "contents_url", "patch")), structure(list(sha = "43876c0a72803b8c01446710f744847f32195c20",
filename = "railties/test/application/configuration_test.rb",
status = "modified", additions = 15L, deletions = 2L, changes = 17L,
blob_url = "https://github.com/rails/rails/blob/8366cabd652a5fbb56fc0942614fbc965e7e45ed/railties/test/application/configuration_test.rb",
raw_url = "https://github.com/rails/rails/raw/8366cabd652a5fbb56fc0942614fbc965e7e45ed/railties/test/application/configuration_test.rb",
contents_url = "https://api.github.com/repos/rails/rails/contents/railties/test/application/configuration_test.rb?ref=8366cabd652a5fbb56fc0942614fbc965e7e45ed",
patch = "@@ -225,8 +225,6 @@ def index\n make_basic_app\n \n class ::OmgControl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment