[
  {
    "path": ".envrc",
    "content": "export PATH=$PWD/bin:$PATH\n"
  },
  {
    "path": ".gitignore",
    "content": ".bundle/\nlog/*.log\npkg/\nspec/dummy/db/*.sqlite3\nspec/dummy/db/*.sqlite3-journal\nspec/dummy/db/schema.rb\nspec/dummy/log/*.log\nspec/dummy/tmp/\nspec/dummy/.sass-cache\nvendor/bundle\nGemfile.lock\ngemfiles/*.lock\n.rspec\n*.gem\n.tags\n.ruby-version\n.idea"
  },
  {
    "path": "Gemfile",
    "content": "source \"https://rubygems.org\"\n\n# Declare your gem's dependencies in rails_sortable.gemspec.\n# Bundler will treat runtime dependencies like base dependencies, and\n# development dependencies will be added by default to the :development group.\ngemspec\n\n# Declare any dependencies that are still in development here instead of in\n# your gemspec. These might include edge Rails or gems from your path or\n# Git. Remember to move these dependencies to your gemspec before releasing\n# your gem to rubygems.org.\n\n# To use debugger\n# gem 'debugger'\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright 2013 itmammoth\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# RailsSortable\n[![Build Status](https://travis-ci.org/itmammoth/rails_sortable.svg?branch=use_travis_ci)](https://travis-ci.org/itmammoth/rails_sortable)\n\nRailsSortable is a simple Rails gem that allows you to create a listing view with drag & drop sorting. The arranged order will be persisted in the table without any pain.\n\n![RailsSortable](https://raw.githubusercontent.com/itmammoth/rails_sortable/master/rails_sortable.gif \"RailsSortable\")\n\n# Setup\n\nAdd the following to your `Gemfile` then run bundle to install them.\n```\ngem 'jquery-rails'\ngem 'jquery-ui-rails'\ngem 'rails_sortable'\n```\n\nAnd then add the following to the asset pipeline in the `application.js`:\n```\n//= require jquery\n//= require jquery_ujs\n//= require jquery-ui/widgets/sortable\n//= require rails_sortable\n```\n\n# Usage\n\nRailsSortable requires a specific column on the ActiveRecord Model for its implementation.\n\nFor instance, the following migration indicates the case that you are attempting to make `Item` model sortable.\n\n```ruby\nclass CreateItems < ActiveRecord::Migration[5.1]\n  def change\n    create_table :items do |t|\n      t.string :title\n      t.integer :sort  # for RailsSortable\n\n      t.timestamps\n    end\n  end\nend\n```\nand `Item` model as\n```ruby\nclass Item < ApplicationRecord\n  include RailsSortable::Model\n  set_sortable :sort  # Indicate a sort column\n  # without_updating_timestamps: true, # If you do NOT want timestamps to be updated on sorting\n  # without_validations: true # If you do NOT want validations to be run on sorting\n\nend\n```\nand `ItemsController` as\n```ruby\nclass ItemsController < ApplicationController\n  def index\n    @items = Item.order(:sort).all\n  end\nend\n```\n\nand the listing view (typically - index.html.erb) as\n```erb\n...\n<table>\n  <tbody class=\"sortable\">  <!-- sortable target -->\n    <% @items.each_with_sortable_id do |item, sortable_id| %>\n      <tr id=\"<%= sortable_id %>\">  <!-- Needs id tag on sorting elements -->\n        <td><%= item.title %></td>\n        <td><%= item.sort %></td>\n        <td><%= link_to 'Show', item %></td>\n        <td><%= link_to 'Edit', edit_item_path(item) %></td>\n        <td><%= link_to 'Destroy', item, method: :delete, data: { confirm: 'Are you sure?' } %></td>\n      </tr>\n    <% end %>\n  </tbody>\n</table>\n\n<!-- or just invoke model#sortable_id to get the id for sotable -->\n...\n<% @items.each do |item| %>\n  <tr id=\"<%= item.sortable_id %>\">\n...\n```\n\nfinally, apply sortable with Javascript.\n\n```javascript\n$(function() {\n  $('.sortable').railsSortable();\n});\n```\n\n## More\nPlease have a look at [Use cases@wiki](https://github.com/itmammoth/rails_sortable/wiki#use-cases) for further information.\n\n# Javascript options\njQuery plugin `railsSortable` is just a wrapper of `jquery.ui.sortable`. therefore it accepts all of `sortable` options.\n\nsee the [http://api.jqueryui.com/sortable/](http://api.jqueryui.com/sortable/) to get the details.\n\n# Contribution\n\nFork it, then install required gems like below.\n```bash\n$ bundle install\n```\n\nPlease give me a PR freely.\n\n### Testing\n```bash\n# Test with a dummy application\n$ spec/dummy/bin/rails db:migrate\n$ spec/dummy/bin/rails s\n# Insert test data\n$ RAILS_ENV=test spec/dummy/bin/rails db:migrate\n$ spec/dummy/bin/rails db:seed\n\n# Run specs\n$ bundle exec rspec\n```\n\n# Licence\n\nMIT Licence.\n"
  },
  {
    "path": "Rakefile",
    "content": "begin\n  require 'bundler/setup'\nrescue LoadError\n  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'\nend\n\nrequire 'rdoc/task'\n\nRDoc::Task.new(:rdoc) do |rdoc|\n  rdoc.rdoc_dir = 'rdoc'\n  rdoc.title    = 'RailsSortable'\n  rdoc.options << '--line-numbers'\n  rdoc.rdoc_files.include('README.rdoc')\n  rdoc.rdoc_files.include('lib/**/*.rb')\nend\n\nAPP_RAKEFILE = File.expand_path(\"../spec/dummy/Rakefile\", __FILE__)\nload 'rails/tasks/engine.rake'\n\n\n\nBundler::GemHelper.install_tasks\n\n"
  },
  {
    "path": "SECURITY.md",
    "content": "# Security Policy\n\n## Supported Versions\n\nUse this section to tell people about which versions of your project are\ncurrently being supported with security updates.\n\n| Version | Supported          |\n| ------- | ------------------ |\n| 5.1.x   | :white_check_mark: |\n| 5.0.x   | :x:                |\n| 4.0.x   | :white_check_mark: |\n| < 4.0   | :x:                |\n\n## Reporting a Vulnerability\n\nUse this section to tell people how to report a vulnerability.\n\nTell them where to go, how often they can expect to get an update on a\nreported vulnerability, what to expect if the vulnerability is accepted or\ndeclined, etc.\n"
  },
  {
    "path": "app/controllers/.keep",
    "content": ""
  },
  {
    "path": "app/controllers/sortable_controller.rb",
    "content": "class SortableController < ApplicationController\n\n  VERIFIER = Rails.application.message_verifier(:rails_sortable_generate_sortable_id)\n\n  #\n  # post /sortable/reorder, rails_sortable: [\n  #   \"BAhJIhVjbGFzcz1JdGVtLGlkPTUwBjoGRVQ=--b48adfad6d6d7764e4106c44fc090fcad15d721e\",\n  #   \"BAhJIhVjbGFzcz1JdGVtLGlkPTQxBjoGRVQ=--ac1c2d3b8eae8dd72e49fae302005e5ae4fc00a4\", ...]\n  # Param `rails_sorable` is an array object containing encoded tokens,\n  # and each token must be able to be decoded with VERIFIER to a string formatted as \"class={CLASS_NAME},id={ID}\".\n  #\n  def reorder\n    ActiveRecord::Base.transaction do\n      params['rails_sortable'].each_with_index do |token, new_sort|\n        next unless token.present?\n        \n        model = find_model(token)\n        current_sort = model.read_attribute(model.class.sort_attribute)\n        model.update_sort!(new_sort) if current_sort != new_sort\n      end\n    end\n\n    head :ok\n  end\n\nprivate\n\n  def find_model(token)\n    klass, id = VERIFIER.verify(token).match(/class=(.+),id=(.+)/)[1..2]\n    klass.constantize.find(id)\n  end\nend\n"
  },
  {
    "path": "app/models/.keep",
    "content": ""
  },
  {
    "path": "app/models/rails_sortable/model.rb",
    "content": "module RailsSortable\n  #\n  # Include this module to your ActiveRecord model.\n  # And you must call `set_sortable` method for using sortable model.\n  #\n  # ex)\n  # class SampleModel < ActiveRecord::Base\n  #   include RailsSortable::Model\n  #   set_sortable :sort, without_updating_timestamps: true\n  # end\n  #\n  module Model\n    def self.included(base)\n      base.class_eval do\n        before_create :maximize_sort\n      end\n      base.extend ClassMethods\n    end\n\n    def update_sort!(new_value)\n      write_attribute sort_attribute, new_value\n\n      if self.class.sortable_options[:silence_recording_timestamps]\n        warn \"[DEPRECATION] `silence_recording_timestamps` is deprecated. Please use `without_updating_timestamps` instead.\"\n        without_updating_timestamps { save_as_desired }\n      elsif self.class.sortable_options[:without_updating_timestamps]\n        without_updating_timestamps { save_as_desired }\n      else\n        save_as_desired\n      end\n    end\n\n    def sortable_id\n      SortableController::VERIFIER.generate(\"class=#{self.class},id=#{self.id}\")\n    end\n\n  protected\n\n    def maximize_sort\n      return if read_attribute(sort_attribute)\n      write_attribute sort_attribute, max_sort\n    end\n\n    def without_updating_timestamps\n      raise ArgumentError unless block_given?\n      original_record_timestamps = self.class.record_timestamps\n      self.class.record_timestamps = false\n      yield\n      self.class.record_timestamps = original_record_timestamps\n    end\n\n    def max_sort\n      (self.class.maximum(sort_attribute) || 0) + 1\n    end\n\n    def save_as_desired\n      self.class.sortable_options[:without_validations] ? save(validate: false) : save!\n    end\n\n    def sort_attribute\n      self.class.sort_attribute\n    end\n\n    module ClassMethods\n      #\n      # allowed options\n      # - without_updating_timestamps\n      #     When it is true, timestamp(updated_at) will be NOT touched on reordering.\n      # - without_validations\n      #     When it is true, validations will be skipped\n      #\n      def set_sortable(attribute, options = {})\n        self.define_singleton_method(:sort_attribute) { attribute }\n        self.define_singleton_method(:sortable_options) { options }\n      end\n    end\n  end\nend\n"
  },
  {
    "path": "bin/bundle",
    "content": "#!/usr/bin/env ruby\n# frozen_string_literal: true\n\n#\n# This file was generated by Bundler.\n#\n# The application 'bundle' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire \"rubygems\"\n\nm = Module.new do\n  module_function\n\n  def invoked_as_script?\n    File.expand_path($0) == File.expand_path(__FILE__)\n  end\n\n  def env_var_version\n    ENV[\"BUNDLER_VERSION\"]\n  end\n\n  def cli_arg_version\n    return unless invoked_as_script? # don't want to hijack other binstubs\n    return unless \"update\".start_with?(ARGV.first || \" \") # must be running `bundle update`\n    bundler_version = nil\n    update_index = nil\n    ARGV.each_with_index do |a, i|\n      if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN\n        bundler_version = a\n      end\n      next unless a =~ /\\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\\z/\n      bundler_version = $1 || \">= 0.a\"\n      update_index = i\n    end\n    bundler_version\n  end\n\n  def gemfile\n    gemfile = ENV[\"BUNDLE_GEMFILE\"]\n    return gemfile if gemfile && !gemfile.empty?\n\n    File.expand_path(\"../../Gemfile\", __FILE__)\n  end\n\n  def lockfile\n    lockfile =\n      case File.basename(gemfile)\n      when \"gems.rb\" then gemfile.sub(/\\.rb$/, gemfile)\n      else \"#{gemfile}.lock\"\n      end\n    File.expand_path(lockfile)\n  end\n\n  def lockfile_version\n    return unless File.file?(lockfile)\n    lockfile_contents = File.read(lockfile)\n    return unless lockfile_contents =~ /\\n\\nBUNDLED WITH\\n\\s{2,}(#{Gem::Version::VERSION_PATTERN})\\n/\n    Regexp.last_match(1)\n  end\n\n  def bundler_version\n    @bundler_version ||= begin\n      env_var_version || cli_arg_version ||\n        lockfile_version || \"#{Gem::Requirement.default}.a\"\n    end\n  end\n\n  def load_bundler!\n    ENV[\"BUNDLE_GEMFILE\"] ||= gemfile\n\n    # must dup string for RG < 1.8 compatibility\n    activate_bundler(bundler_version.dup)\n  end\n\n  def activate_bundler(bundler_version)\n    if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new(\"2.0\")\n      bundler_version = \"< 2\"\n    end\n    gem_error = activation_error_handling do\n      gem \"bundler\", bundler_version\n    end\n    return if gem_error.nil?\n    require_error = activation_error_handling do\n      require \"bundler/version\"\n    end\n    return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))\n    warn \"Activating bundler (#{bundler_version}) failed:\\n#{gem_error.message}\\n\\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`\"\n    exit 42\n  end\n\n  def activation_error_handling\n    yield\n    nil\n  rescue StandardError, LoadError => e\n    e\n  end\nend\n\nm.load_bundler!\n\nif m.invoked_as_script?\n  load Gem.bin_path(\"bundler\", \"bundle\")\nend\n"
  },
  {
    "path": "bin/coderay",
    "content": "#!/usr/bin/env ruby\n# frozen_string_literal: true\n\n#\n# This file was generated by Bundler.\n#\n# The application 'coderay' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire \"pathname\"\nENV[\"BUNDLE_GEMFILE\"] ||= File.expand_path(\"../../Gemfile\",\n  Pathname.new(__FILE__).realpath)\n\nbundle_binstub = File.expand_path(\"../bundle\", __FILE__)\n\nif File.file?(bundle_binstub)\n  if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/\n    load(bundle_binstub)\n  else\n    abort(\"Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.\nReplace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.\")\n  end\nend\n\nrequire \"rubygems\"\nrequire \"bundler/setup\"\n\nload Gem.bin_path(\"coderay\", \"coderay\")\n"
  },
  {
    "path": "bin/htmldiff",
    "content": "#!/usr/bin/env ruby\n# frozen_string_literal: true\n\n#\n# This file was generated by Bundler.\n#\n# The application 'htmldiff' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire \"pathname\"\nENV[\"BUNDLE_GEMFILE\"] ||= File.expand_path(\"../../Gemfile\",\n  Pathname.new(__FILE__).realpath)\n\nbundle_binstub = File.expand_path(\"../bundle\", __FILE__)\n\nif File.file?(bundle_binstub)\n  if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/\n    load(bundle_binstub)\n  else\n    abort(\"Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.\nReplace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.\")\n  end\nend\n\nrequire \"rubygems\"\nrequire \"bundler/setup\"\n\nload Gem.bin_path(\"diff-lcs\", \"htmldiff\")\n"
  },
  {
    "path": "bin/ldiff",
    "content": "#!/usr/bin/env ruby\n# frozen_string_literal: true\n\n#\n# This file was generated by Bundler.\n#\n# The application 'ldiff' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire \"pathname\"\nENV[\"BUNDLE_GEMFILE\"] ||= File.expand_path(\"../../Gemfile\",\n  Pathname.new(__FILE__).realpath)\n\nbundle_binstub = File.expand_path(\"../bundle\", __FILE__)\n\nif File.file?(bundle_binstub)\n  if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/\n    load(bundle_binstub)\n  else\n    abort(\"Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.\nReplace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.\")\n  end\nend\n\nrequire \"rubygems\"\nrequire \"bundler/setup\"\n\nload Gem.bin_path(\"diff-lcs\", \"ldiff\")\n"
  },
  {
    "path": "bin/nokogiri",
    "content": "#!/usr/bin/env ruby\n# frozen_string_literal: true\n\n#\n# This file was generated by Bundler.\n#\n# The application 'nokogiri' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire \"pathname\"\nENV[\"BUNDLE_GEMFILE\"] ||= File.expand_path(\"../../Gemfile\",\n  Pathname.new(__FILE__).realpath)\n\nbundle_binstub = File.expand_path(\"../bundle\", __FILE__)\n\nif File.file?(bundle_binstub)\n  if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/\n    load(bundle_binstub)\n  else\n    abort(\"Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.\nReplace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.\")\n  end\nend\n\nrequire \"rubygems\"\nrequire \"bundler/setup\"\n\nload Gem.bin_path(\"nokogiri\", \"nokogiri\")\n"
  },
  {
    "path": "bin/pry",
    "content": "#!/usr/bin/env ruby\n# frozen_string_literal: true\n\n#\n# This file was generated by Bundler.\n#\n# The application 'pry' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire \"pathname\"\nENV[\"BUNDLE_GEMFILE\"] ||= File.expand_path(\"../../Gemfile\",\n  Pathname.new(__FILE__).realpath)\n\nbundle_binstub = File.expand_path(\"../bundle\", __FILE__)\n\nif File.file?(bundle_binstub)\n  if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/\n    load(bundle_binstub)\n  else\n    abort(\"Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.\nReplace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.\")\n  end\nend\n\nrequire \"rubygems\"\nrequire \"bundler/setup\"\n\nload Gem.bin_path(\"pry\", \"pry\")\n"
  },
  {
    "path": "bin/rackup",
    "content": "#!/usr/bin/env ruby\n# frozen_string_literal: true\n\n#\n# This file was generated by Bundler.\n#\n# The application 'rackup' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire \"pathname\"\nENV[\"BUNDLE_GEMFILE\"] ||= File.expand_path(\"../../Gemfile\",\n  Pathname.new(__FILE__).realpath)\n\nbundle_binstub = File.expand_path(\"../bundle\", __FILE__)\n\nif File.file?(bundle_binstub)\n  if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/\n    load(bundle_binstub)\n  else\n    abort(\"Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.\nReplace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.\")\n  end\nend\n\nrequire \"rubygems\"\nrequire \"bundler/setup\"\n\nload Gem.bin_path(\"rack\", \"rackup\")\n"
  },
  {
    "path": "bin/rails",
    "content": "#!/usr/bin/env ruby\n# frozen_string_literal: true\n\n#\n# This file was generated by Bundler.\n#\n# The application 'rails' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire \"pathname\"\nENV[\"BUNDLE_GEMFILE\"] ||= File.expand_path(\"../../Gemfile\",\n  Pathname.new(__FILE__).realpath)\n\nbundle_binstub = File.expand_path(\"../bundle\", __FILE__)\n\nif File.file?(bundle_binstub)\n  if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/\n    load(bundle_binstub)\n  else\n    abort(\"Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.\nReplace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.\")\n  end\nend\n\nrequire \"rubygems\"\nrequire \"bundler/setup\"\n\nload Gem.bin_path(\"railties\", \"rails\")\n"
  },
  {
    "path": "bin/rake",
    "content": "#!/usr/bin/env ruby\n# frozen_string_literal: true\n\n#\n# This file was generated by Bundler.\n#\n# The application 'rake' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire \"pathname\"\nENV[\"BUNDLE_GEMFILE\"] ||= File.expand_path(\"../../Gemfile\",\n  Pathname.new(__FILE__).realpath)\n\nbundle_binstub = File.expand_path(\"../bundle\", __FILE__)\n\nif File.file?(bundle_binstub)\n  if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/\n    load(bundle_binstub)\n  else\n    abort(\"Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.\nReplace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.\")\n  end\nend\n\nrequire \"rubygems\"\nrequire \"bundler/setup\"\n\nload Gem.bin_path(\"rake\", \"rake\")\n"
  },
  {
    "path": "bin/rspec",
    "content": "#!/usr/bin/env ruby\n# frozen_string_literal: true\n\n#\n# This file was generated by Bundler.\n#\n# The application 'rspec' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire \"pathname\"\nENV[\"BUNDLE_GEMFILE\"] ||= File.expand_path(\"../../Gemfile\",\n  Pathname.new(__FILE__).realpath)\n\nbundle_binstub = File.expand_path(\"../bundle\", __FILE__)\n\nif File.file?(bundle_binstub)\n  if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/\n    load(bundle_binstub)\n  else\n    abort(\"Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.\nReplace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.\")\n  end\nend\n\nrequire \"rubygems\"\nrequire \"bundler/setup\"\n\nload Gem.bin_path(\"rspec-core\", \"rspec\")\n"
  },
  {
    "path": "bin/sprockets",
    "content": "#!/usr/bin/env ruby\n# frozen_string_literal: true\n\n#\n# This file was generated by Bundler.\n#\n# The application 'sprockets' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire \"pathname\"\nENV[\"BUNDLE_GEMFILE\"] ||= File.expand_path(\"../../Gemfile\",\n  Pathname.new(__FILE__).realpath)\n\nbundle_binstub = File.expand_path(\"../bundle\", __FILE__)\n\nif File.file?(bundle_binstub)\n  if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/\n    load(bundle_binstub)\n  else\n    abort(\"Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.\nReplace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.\")\n  end\nend\n\nrequire \"rubygems\"\nrequire \"bundler/setup\"\n\nload Gem.bin_path(\"sprockets\", \"sprockets\")\n"
  },
  {
    "path": "bin/thor",
    "content": "#!/usr/bin/env ruby\n# frozen_string_literal: true\n\n#\n# This file was generated by Bundler.\n#\n# The application 'thor' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire \"pathname\"\nENV[\"BUNDLE_GEMFILE\"] ||= File.expand_path(\"../../Gemfile\",\n  Pathname.new(__FILE__).realpath)\n\nbundle_binstub = File.expand_path(\"../bundle\", __FILE__)\n\nif File.file?(bundle_binstub)\n  if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/\n    load(bundle_binstub)\n  else\n    abort(\"Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.\nReplace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.\")\n  end\nend\n\nrequire \"rubygems\"\nrequire \"bundler/setup\"\n\nload Gem.bin_path(\"thor\", \"thor\")\n"
  },
  {
    "path": "config/routes.rb",
    "content": "Rails.application.routes.draw do\n  post \"/sortable/reorder\", to: \"sortable#reorder\"\nend\n"
  },
  {
    "path": "lib/rails_sortable/core_ext/enumerable.rb",
    "content": "module Enumerable\n  def each_with_sortable_id(&block)\n    raise \"Must be called with block!\" unless block_given?\n    each { |e| yield e, e.sortable_id }\n  end\nend\n"
  },
  {
    "path": "lib/rails_sortable/core_ext.rb",
    "content": "Dir.glob(File.expand_path('core_ext/*.rb', File.dirname(__FILE__))).each do |path|\n  require path\nend\n"
  },
  {
    "path": "lib/rails_sortable/engine.rb",
    "content": "module RailsSortable\n  class Engine < ::Rails::Engine\n  end\nend\n"
  },
  {
    "path": "lib/rails_sortable/version.rb",
    "content": "module RailsSortable\n  VERSION = '1.6.0'\nend\n"
  },
  {
    "path": "lib/rails_sortable.rb",
    "content": "require \"rails_sortable/engine\"\nrequire \"rails_sortable/core_ext\"\n\nmodule RailsSortable\nend\n"
  },
  {
    "path": "rails_sortable.gemspec",
    "content": "$:.push File.expand_path(\"../lib\", __FILE__)\n\n# Maintain your gem's version:\nrequire \"rails_sortable/version\"\n\n# Describe your gem and declare its dependencies:\nGem::Specification.new do |s|\n  s.name        = \"rails_sortable\"\n  s.version     = RailsSortable::VERSION\n  s.authors     = [\"itmammoth\"]\n  s.email       = [\"itmammoth@gmail.com\"]\n  s.homepage    = \"https://github.com/itmammoth/rails_sortable\"\n  s.summary     = \"Easy drag & drop sorting for rails.\"\n  s.description = \"rails_sortable provides easy drag & drop sorting for rails 4 and 5.\"\n  s.licenses    = ['MIT']\n\n  s.files = Dir[\"{app,config,lib,vendor/assets}/**/*\", \"LICENSE\", \"Rakefile\", \"README.md\"]\n\n  s.test_files = `git ls-files spec`.split(\"\\n\")\n\n  s.add_development_dependency \"rails\", \"~> 6.0.0\"\n  s.add_development_dependency \"jquery-rails\", \"~> 4.3.0\"\n  s.add_development_dependency \"jquery-ui-rails\", \"~> 6.0.0\"\n  s.add_development_dependency \"sqlite3\", \"~> 1.4.0\"\n  s.add_development_dependency \"rspec-rails\", \"~> 3.9.0\"\n  s.add_development_dependency \"pry-rails\", \"~> 0.3.0\"\n  s.add_development_dependency \"puma\", \"~> 5.6.0\"\nend\n"
  },
  {
    "path": "spec/controllers/sortable_controller_spec.rb",
    "content": "require 'spec_helper'\n\ndef create_token(klass, id)\n  return SortableController::VERIFIER.generate(\"class=#{klass},id=#{id}\")\nend\n\ndescribe SortableController, type: :controller do\n  describe 'POST reorder' do\n    before do\n      @item1 = Item.create!\n      @item2 = Item.create!\n      @item3 = Item.create!\n    end\n    it 'should reorder models' do\n      data = [\n        create_token('Item', @item1.to_param),\n        create_token('Item', @item3.to_param),\n        create_token('Item', @item2.to_param),\n      ]\n      if Gem::Version.new(Rails.version) < Gem::Version.new(5)\n        post :reorder, rails_sortable: data\n      else\n        post :reorder, params: { rails_sortable: data }\n      end\n      expect(response.body).to be_blank\n      expect(Item.find(@item1.id).sort).to eql 0\n      expect(Item.find(@item2.id).sort).to eql 2\n      expect(Item.find(@item3.id).sort).to eql 1\n    end\n  end\n\n  describe 'POST reorder with multiple classes' do\n    before do\n      @first_item1 = FirstItem.create!\n      @first_item2 = FirstItem.create!\n      @second_item1 = SecondItem.create!\n      @second_item2 = SecondItem.create!\n    end\n    it 'should reorder models' do\n      data = [\n        create_token('SecondItem', @second_item2.to_param),\n        create_token('FirstItem', @first_item2.to_param),\n        create_token('FirstItem', @first_item1.to_param),\n        create_token('SecondItem', @second_item1.to_param),\n      ]\n      if Gem::Version.new(Rails.version) < Gem::Version.new(5)\n        post :reorder, rails_sortable: data\n      else\n        post :reorder, params: { rails_sortable: data }\n      end\n      expect(response.body).to be_blank\n      expect(SecondItem.find(@second_item2.id).sort).to eql 0\n      expect(FirstItem.find(@first_item2.id).sort).to eql 1\n      expect(FirstItem.find(@first_item1.id).sort).to eql 2\n      expect(SecondItem.find(@second_item1.id).sort).to eql 3\n    end\n  end\nend\n"
  },
  {
    "path": "spec/dummy/README.rdoc",
    "content": "== README\n\nThis README would normally document whatever steps are necessary to get the\napplication up and running.\n\nThings you may want to cover:\n\n* Ruby version\n\n* System dependencies\n\n* Configuration\n\n* Database creation\n\n* Database initialization\n\n* How to run the test suite\n\n* Services (job queues, cache servers, search engines, etc.)\n\n* Deployment instructions\n\n* ...\n\n\nPlease feel free to use a different markup language if you do not plan to run\n<tt>rake doc:app</tt>.\n"
  },
  {
    "path": "spec/dummy/Rakefile",
    "content": "# 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\nrequire File.expand_path('../config/application', __FILE__)\n\nDummy::Application.load_tasks\n"
  },
  {
    "path": "spec/dummy/app/assets/config/manifest.js",
    "content": "//= link_tree ../images\n//= link_directory ../javascripts .js\n//= link_directory ../stylesheets .css\n"
  },
  {
    "path": "spec/dummy/app/assets/images/.keep",
    "content": ""
  },
  {
    "path": "spec/dummy/app/assets/javascripts/application.js",
    "content": "// This is a manifest file that'll be compiled into application.js, which will include all the files\n// listed below.\n//\n// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,\n// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.\n//\n// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the\n// compiled file.\n//\n// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details\n// about supported directives.\n//\n//= require jquery\n//= require jquery_ujs\n//= require jquery-ui/widgets/sortable\n//= require rails_sortable\n//= require_tree .\n"
  },
  {
    "path": "spec/dummy/app/assets/javascripts/items.js",
    "content": "(function($) {\n  $(\".sortable-items\").railsSortable({\n    update: function(event, ui) {\n        console.log('Yay! RailsSortable never spoil your implementation for sotable events.');\n        console.log(event, ui);\n    },\n  });\n})(jQuery);"
  },
  {
    "path": "spec/dummy/app/assets/javascripts/multiple_classes.js",
    "content": "(function($) {\n    $(\".sortable-multiple-classes\").railsSortable();\n})(jQuery);"
  },
  {
    "path": "spec/dummy/app/assets/javascripts/sequenced_items.js",
    "content": "(function($) {\n  $(\".sortable-sequenced-items\").railsSortable();\n})(jQuery);"
  },
  {
    "path": "spec/dummy/app/assets/stylesheets/application.css",
    "content": "/*\n * This is a manifest file that'll be compiled into application.css, which will include all the files\n * listed below.\n *\n * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,\n * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.\n *\n * You're free to add application-wide styles to this file and they'll appear at the top of the\n * compiled file, but it's generally better to create a new file per style scope.\n *\n *= require_self\n *= require_tree .\n */\n"
  },
  {
    "path": "spec/dummy/app/assets/stylesheets/scaffold.css",
    "content": "body { background-color: #fff; color: #333; }\n\nbody, p, ol, ul, td {\n  font-family: verdana, arial, helvetica, sans-serif;\n  font-size:   13px;\n  line-height: 18px;\n}\n\npre {\n  background-color: #eee;\n  padding: 10px;\n  font-size: 11px;\n}\n\na { color: #000; }\na:visited { color: #666; }\na:hover { color: #fff; background-color:#000; }\n\ndiv.field, div.actions {\n  margin-bottom: 10px;\n}\n\n#notice {\n  color: green;\n}\n\n.field_with_errors {\n  padding: 2px;\n  background-color: red;\n  display: table;\n}\n\n#error_explanation {\n  width: 450px;\n  border: 2px solid red;\n  padding: 7px;\n  padding-bottom: 0;\n  margin-bottom: 20px;\n  background-color: #f0f0f0;\n}\n\n#error_explanation h2 {\n  text-align: left;\n  font-weight: bold;\n  padding: 5px 5px 5px 15px;\n  font-size: 12px;\n  margin: -7px;\n  margin-bottom: 0px;\n  background-color: #c00;\n  color: #fff;\n}\n\n#error_explanation ul li {\n  font-size: 12px;\n  list-style: square;\n}\n"
  },
  {
    "path": "spec/dummy/app/controllers/application_controller.rb",
    "content": "class ApplicationController < ActionController::Base\n  # Prevent CSRF attacks by raising an exception.\n  # For APIs, you may want to use :null_session instead.\n  protect_from_forgery with: :exception\nend\n"
  },
  {
    "path": "spec/dummy/app/controllers/concerns/.keep",
    "content": ""
  },
  {
    "path": "spec/dummy/app/controllers/items_controller.rb",
    "content": "class ItemsController < ApplicationController\n  before_action :set_item, only: [:show, :edit, :update, :destroy]\n\n  # GET /items\n  def index\n    @items = Item.all\n  end\n\n  # GET /items/1\n  def show\n  end\n\n  # GET /items/new\n  def new\n    @item = Item.new\n  end\n\n  # GET /items/1/edit\n  def edit\n  end\n\n  # POST /items\n  def create\n    @item = Item.new(item_params)\n\n    if @item.save\n      redirect_to @item, notice: 'Item was successfully created.'\n    else\n      render action: 'new'\n    end\n  end\n\n  # PATCH/PUT /items/1\n  def update\n    if @item.update(item_params)\n      redirect_to @item, notice: 'Item was successfully updated.'\n    else\n      render action: 'edit'\n    end\n  end\n\n  # DELETE /items/1\n  def destroy\n    @item.destroy\n    redirect_to items_url, notice: 'Item was successfully destroyed.'\n  end\n\n  private\n    # Use callbacks to share common setup or constraints between actions.\n    def set_item\n      @item = Item.find(params[:id])\n    end\n\n    # Only allow a trusted parameter \"white list\" through.\n    def item_params\n      params.require(:item).permit(:title, :sort)\n    end\nend\n"
  },
  {
    "path": "spec/dummy/app/controllers/multiple_classes_controller.rb",
    "content": "class MultipleClassesController < ApplicationController\n  # GET /multiple_classes\n  def index\n    @items = (FirstItem.all + SecondItem.all).sort_by(&:sort)\n  end\nend\n"
  },
  {
    "path": "spec/dummy/app/controllers/sequenced_items_controller.rb",
    "content": "class SequencedItemsController < ApplicationController\n  before_action :set_sequenced_item, only: [:show, :edit, :update, :destroy]\n\n  # GET /sequenced_items\n  def index\n    @sequenced_items = SequencedItem.all\n  end\n\n  # GET /sequenced_items/1\n  def show\n  end\n\n  # GET /sequenced_items/new\n  def new\n    @sequenced_item = SequencedItem.new\n  end\n\n  # GET /sequenced_items/1/edit\n  def edit\n  end\n\n  # POST /sequenced_items\n  def create\n    @sequenced_item = SequencedItem.new(sequenced_item_params)\n\n    if @sequenced_item.save\n      redirect_to @sequenced_item, notice: 'Other item was successfully created.'\n    else\n      render action: 'new'\n    end\n  end\n\n  # PATCH/PUT /sequenced_items/1\n  def update\n    if @sequenced_item.update(sequenced_item_params)\n      redirect_to @sequenced_item, notice: 'Other item was successfully updated.'\n    else\n      render action: 'edit'\n    end\n  end\n\n  # DELETE /sequenced_items/1\n  def destroy\n    @sequenced_item.destroy\n    redirect_to sequenced_items_url, notice: 'Other item was successfully destroyed.'\n  end\n\n  private\n    # Use callbacks to share common setup or constraints between actions.\n    def set_sequenced_item\n      @sequenced_item = SequencedItem.find(params[:id])\n    end\n\n    # Only allow a trusted parameter \"white list\" through.\n    def sequenced_item_params\n      params.require(:sequenced_item).permit(:title, :sequence)\n    end\nend\n"
  },
  {
    "path": "spec/dummy/app/models/.keep",
    "content": ""
  },
  {
    "path": "spec/dummy/app/models/concerns/.keep",
    "content": ""
  },
  {
    "path": "spec/dummy/app/models/first_item.rb",
    "content": "class FirstItem < ActiveRecord::Base\n  include RailsSortable::Model\n  set_sortable :sort\n\n  default_scope -> { order(:sort) }\nend\n"
  },
  {
    "path": "spec/dummy/app/models/item.rb",
    "content": "class Item < ActiveRecord::Base\n  include RailsSortable::Model\n  set_sortable :sort\n\n  default_scope -> { order(:sort) }\nend\n"
  },
  {
    "path": "spec/dummy/app/models/second_item.rb",
    "content": "class SecondItem < ActiveRecord::Base\n  include RailsSortable::Model\n  set_sortable :sort\n\n  default_scope -> { order(:sort) }\nend\n"
  },
  {
    "path": "spec/dummy/app/models/sequenced_item.rb",
    "content": "class SequencedItem < ActiveRecord::Base\n  include RailsSortable::Model\n  set_sortable :sequence, without_updating_timestamps: true\n\n  default_scope -> { order(:sequence) }\nend\n"
  },
  {
    "path": "spec/dummy/app/models/validated_item.rb",
    "content": "class ValidatedItem < Item\n  self.table_name = \"items\"\n  validates_presence_of :title\nend\n"
  },
  {
    "path": "spec/dummy/app/views/items/_form.html.erb",
    "content": "<%= form_for(@item) do |f| %>\n  <% if @item.errors.any? %>\n    <div id=\"error_explanation\">\n      <h2><%= pluralize(@item.errors.count, \"error\") %> prohibited this item from being saved:</h2>\n\n      <ul>\n      <% @item.errors.full_messages.each do |msg| %>\n        <li><%= msg %></li>\n      <% end %>\n      </ul>\n    </div>\n  <% end %>\n\n  <div class=\"field\">\n    <%= f.label :title %><br>\n    <%= f.text_field :title %>\n  </div>\n  <div class=\"field\">\n    <%= f.label :sort %><br>\n    <%= f.number_field :sort %>\n  </div>\n  <div class=\"actions\">\n    <%= f.submit %>\n  </div>\n<% end %>\n"
  },
  {
    "path": "spec/dummy/app/views/items/edit.html.erb",
    "content": "<h1>Editing item</h1>\n\n<%= render 'form' %>\n\n<%= link_to 'Show', @item %> |\n<%= link_to 'Back', items_path %>\n"
  },
  {
    "path": "spec/dummy/app/views/items/index.html.erb",
    "content": "<h1>Listing items</h1>\n\n<table>\n  <thead>\n    <tr>\n      <th>Title</th>\n      <th>Sort</th>\n      <th>Updated at</th>\n      <th></th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n\n  <tbody class=\"sortable-items\">\n    <% @items.each_with_sortable_id do |item, sortable_id| %>\n      <tr id=\"<%= sortable_id %>\">\n        <td><%= item.title %></td>\n        <td><%= item.sort %></td>\n        <td><%= item.updated_at %></td>\n        <td><%= link_to 'Show', item %></td>\n        <td><%= link_to 'Edit', edit_item_path(item) %></td>\n        <td><%= link_to 'Destroy', item, method: :delete, data: { confirm: 'Are you sure?' } %></td>\n      </tr>\n    <% end %>\n  </tbody>\n</table>\n\n<br>\n\n<%= link_to 'New Item', new_item_path %>\n"
  },
  {
    "path": "spec/dummy/app/views/items/new.html.erb",
    "content": "<h1>New item</h1>\n\n<%= render 'form' %>\n\n<%= link_to 'Back', items_path %>\n"
  },
  {
    "path": "spec/dummy/app/views/items/show.html.erb",
    "content": "<p id=\"notice\"><%= notice %></p>\n\n<p>\n  <strong>Title:</strong>\n  <%= @item.title %>\n</p>\n\n<p>\n  <strong>Sort:</strong>\n  <%= @item.sort %>\n</p>\n\n<%= link_to 'Edit', edit_item_path(@item) %> |\n<%= link_to 'Back', items_path %>\n"
  },
  {
    "path": "spec/dummy/app/views/layouts/application.html.erb",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <title>Dummy</title>\n  <%= stylesheet_link_tag    \"application\", media: \"all\", \"data-turbolinks-track\" => true, :defer => true %>\n  <%= javascript_include_tag \"application\", \"data-turbolinks-track\" => true, :defer => true %>\n  <%= csrf_meta_tags %>\n</head>\n<body>\n\n<%= yield %>\n\n</body>\n</html>\n"
  },
  {
    "path": "spec/dummy/app/views/multiple_classes/index.html.erb",
    "content": "<h1>Listing multiple class items</h1>\n\n<table>\n  <thead>\n    <tr>\n      <th>Title</th>\n      <th>Sort</th>\n      <th>Updated at</th>\n      <th></th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n\n  <tbody class=\"sortable-multiple-classes\">\n    <% @items.each_with_sortable_id do |item, sortable_id| %>\n      <tr id=\"<%= sortable_id %>\">\n        <td><%= item.title %></td>\n        <td><%= item.sort %></td>\n        <td><%= item.updated_at %></td>\n      </tr>\n    <% end %>\n  </tbody>\n</table>"
  },
  {
    "path": "spec/dummy/app/views/sequenced_items/_form.html.erb",
    "content": "<%= form_for(@sequenced_item) do |f| %>\n  <% if @sequenced_item.errors.any? %>\n    <div id=\"error_explanation\">\n      <h2><%= pluralize(@sequenced_item.errors.count, \"error\") %> prohibited this sequenced_item from being saved:</h2>\n\n      <ul>\n      <% @sequenced_item.errors.full_messages.each do |msg| %>\n        <li><%= msg %></li>\n      <% end %>\n      </ul>\n    </div>\n  <% end %>\n\n  <div class=\"field\">\n    <%= f.label :title %><br>\n    <%= f.text_field :title %>\n  </div>\n  <div class=\"field\">\n    <%= f.label :sequence %><br>\n    <%= f.number_field :sequence %>\n  </div>\n  <div class=\"actions\">\n    <%= f.submit %>\n  </div>\n<% end %>\n"
  },
  {
    "path": "spec/dummy/app/views/sequenced_items/edit.html.erb",
    "content": "<h1>Editing sequenced_item</h1>\n\n<%= render 'form' %>\n\n<%= link_to 'Show', @sequenced_item %> |\n<%= link_to 'Back', sequenced_items_path %>\n"
  },
  {
    "path": "spec/dummy/app/views/sequenced_items/index.html.erb",
    "content": "<h1>Listing sequenced_items</h1>\n\n<table>\n  <thead>\n    <tr>\n      <th>Title</th>\n      <th>Sequence</th>\n      <th>Updated at</th>\n      <th></th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n\n  <tbody class=\"sortable-sequenced-items\">\n    <% @sequenced_items.each_with_sortable_id do |sequenced_item, sortable_id| %>\n      <tr id=\"<%= sortable_id %>\">\n        <td><%= sequenced_item.title %></td>\n        <td><%= sequenced_item.sequence %></td>\n        <td><%= sequenced_item.updated_at %></td>\n        <td><%= link_to 'Show', sequenced_item %></td>\n        <td><%= link_to 'Edit', edit_sequenced_item_path(sequenced_item) %></td>\n        <td><%= link_to 'Destroy', sequenced_item, method: :delete, data: { confirm: 'Are you sure?' } %></td>\n      </tr>\n    <% end %>\n  </tbody>\n</table>\n\n<br>\n\n<%= link_to 'New Sequenced item', new_sequenced_item_path %>\n"
  },
  {
    "path": "spec/dummy/app/views/sequenced_items/new.html.erb",
    "content": "<h1>New sequenced_item</h1>\n\n<%= render 'form' %>\n\n<%= link_to 'Back', sequenced_items_path %>\n"
  },
  {
    "path": "spec/dummy/app/views/sequenced_items/show.html.erb",
    "content": "<p id=\"notice\"><%= notice %></p>\n\n<p>\n  <strong>Title:</strong>\n  <%= @sequenced_item.title %>\n</p>\n\n<p>\n  <strong>Sequence:</strong>\n  <%= @sequenced_item.sequence %>\n</p>\n\n<%= link_to 'Edit', edit_sequenced_item_path(@sequenced_item) %> |\n<%= link_to 'Back', sequenced_items_path %>\n"
  },
  {
    "path": "spec/dummy/bin/bundle",
    "content": "#!/usr/bin/env ruby\nENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)\nload Gem.bin_path('bundler', 'bundle')\n"
  },
  {
    "path": "spec/dummy/bin/rails",
    "content": "#!/usr/bin/env ruby\nAPP_PATH = File.expand_path('../../config/application',  __FILE__)\nrequire_relative '../config/boot'\nrequire 'rails/commands'\n"
  },
  {
    "path": "spec/dummy/bin/rake",
    "content": "#!/usr/bin/env ruby\nrequire_relative '../config/boot'\nrequire 'rake'\nRake.application.run\n"
  },
  {
    "path": "spec/dummy/config/application.rb",
    "content": "require File.expand_path('../boot', __FILE__)\n\n# Pick the frameworks you want:\nrequire \"active_record/railtie\"\nrequire \"action_controller/railtie\"\nrequire \"action_mailer/railtie\"\nrequire \"sprockets/railtie\"\n# require \"rails/test_unit/railtie\"\n\nBundler.require(*Rails.groups)\nrequire \"rails_sortable\"\n\nmodule Dummy\n  class Application < Rails::Application\n    # Settings in config/environments/* take precedence over those specified here.\n    # Application configuration should go into files in config/initializers\n    # -- all .rb files in that directory are automatically loaded.\n\n    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.\n    # Run \"rake -D time\" for a list of tasks for finding time zone names. Default is UTC.\n    # config.time_zone = 'Central Time (US & Canada)'\n\n    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.\n    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]\n    # config.i18n.default_locale = :de\n  end\n\n  MigrationClass = Gem::Version.new(Rails.version) < Gem::Version.new(5) ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]\nend\n\n"
  },
  {
    "path": "spec/dummy/config/boot.rb",
    "content": "# Set up gems listed in the Gemfile.\nENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)\n\nrequire 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])\n$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)\n"
  },
  {
    "path": "spec/dummy/config/database.yml",
    "content": "# SQLite version 3.x\n#   gem install sqlite3\n#\n#   Ensure the SQLite 3 gem is defined in your Gemfile\n#   gem 'sqlite3'\ndevelopment:\n  adapter: sqlite3\n  database: db/development.sqlite3\n  pool: 5\n  timeout: 5000\n\n# Warning: The database defined as \"test\" will be erased and\n# re-generated from your development database when you run \"rake\".\n# Do not set this db to the same as development or production.\ntest:\n  adapter: sqlite3\n  database: db/test.sqlite3\n  pool: 5\n  timeout: 5000\n\nproduction:\n  adapter: sqlite3\n  database: db/production.sqlite3\n  pool: 5\n  timeout: 5000\n"
  },
  {
    "path": "spec/dummy/config/environment.rb",
    "content": "# Load the Rails application.\nrequire File.expand_path('../application', __FILE__)\n\n# Initialize the Rails application.\nDummy::Application.initialize!\n"
  },
  {
    "path": "spec/dummy/config/environments/development.rb",
    "content": "Dummy::Application.configure do\n  # Settings specified here will take precedence over those in config/application.rb.\n\n  # In the development environment your application's code is reloaded on\n  # every request. This slows down response time but is perfect for development\n  # since you don't have to restart the web server when you make code changes.\n  config.cache_classes = false\n\n  # Do not eager load code on boot.\n  config.eager_load = false\n\n  # Show full error reports and disable caching.\n  config.consider_all_requests_local       = true\n  config.action_controller.perform_caching = false\n\n  # Don't care if the mailer can't send.\n  config.action_mailer.raise_delivery_errors = false\n\n  # Print deprecation notices to the Rails logger.\n  config.active_support.deprecation = :log\n\n  # Raise an error on page load if there are pending migrations\n  config.active_record.migration_error = :page_load\n\n  # Debug mode disables concatenation and preprocessing of assets.\n  # This option may cause significant delays in view rendering with a large\n  # number of complex assets.\n  config.assets.debug = true\nend\n"
  },
  {
    "path": "spec/dummy/config/environments/production.rb",
    "content": "Dummy::Application.configure do\n  # Settings specified here will take precedence over those in config/application.rb.\n\n  # Code is not reloaded between requests.\n  config.cache_classes = true\n\n  # Eager load code on boot. This eager loads most of Rails and\n  # your application in memory, allowing both thread web servers\n  # and those relying on copy on write to perform better.\n  # Rake tasks automatically ignore this option for performance.\n  config.eager_load = true\n\n  # Full error reports are disabled and caching is turned on.\n  config.consider_all_requests_local       = false\n  config.action_controller.perform_caching = true\n\n  # Enable Rack::Cache to put a simple HTTP cache in front of your application\n  # Add `rack-cache` to your Gemfile before enabling this.\n  # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.\n  # config.action_dispatch.rack_cache = true\n\n  # Disable Rails's static asset server (Apache or nginx will already do this).\n  if Gem::Version.new(Rails.version) < Gem::Version.new(5)\n    config.serve_static_files  = false\n  else\n    config.public_file_server.enabled = false\n  end\n\n  # Compress JavaScripts and CSS.\n  config.assets.js_compressor = :uglifier\n  # config.assets.css_compressor = :sass\n\n  # Do not fallback to assets pipeline if a precompiled asset is missed.\n  config.assets.compile = false\n\n  # Generate digests for assets URLs.\n  config.assets.digest = true\n\n  # Version of your assets, change this if you want to expire all your assets.\n  config.assets.version = '1.0'\n\n  # Specifies the header that your server uses for sending files.\n  # config.action_dispatch.x_sendfile_header = \"X-Sendfile\" # for apache\n  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx\n\n  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.\n  # config.force_ssl = true\n\n  # Set to :debug to see everything in the log.\n  config.log_level = :info\n\n  # Prepend all log lines with the following tags.\n  # config.log_tags = [ :subdomain, :uuid ]\n\n  # Use a different logger for distributed setups.\n  # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)\n\n  # Use a different cache store in production.\n  # config.cache_store = :mem_cache_store\n\n  # Enable serving of images, stylesheets, and JavaScripts from an asset server.\n  # config.action_controller.asset_host = \"http://assets.example.com\"\n\n  # Precompile additional assets.\n  # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.\n  # config.assets.precompile += %w( search.js )\n\n  # Ignore bad email addresses and do not raise email delivery errors.\n  # Set this to true and configure the email server for immediate delivery to raise delivery errors.\n  # config.action_mailer.raise_delivery_errors = false\n\n  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to\n  # the I18n.default_locale when a translation can not be found).\n  config.i18n.fallbacks = [I18n.default_locale]\n\n  # Send deprecation notices to registered listeners.\n  config.active_support.deprecation = :notify\n\n  # Disable automatic flushing of the log to improve performance.\n  # config.autoflush_log = false\n\n  # Use default logging formatter so that PID and timestamp are not suppressed.\n  config.log_formatter = ::Logger::Formatter.new\nend\n"
  },
  {
    "path": "spec/dummy/config/environments/test.rb",
    "content": "Dummy::Application.configure do\n  # Settings specified here will take precedence over those in config/application.rb.\n\n  # The test environment is used exclusively to run your application's\n  # test suite. You never need to work with it otherwise. Remember that\n  # your test database is \"scratch space\" for the test suite and is wiped\n  # and recreated between test runs. Don't rely on the data there!\n  config.cache_classes = true\n\n  # Do not eager load code on boot. This avoids loading your whole application\n  # just for the purpose of running a single test. If you are using a tool that\n  # preloads Rails for running tests, you may have to set it to true.\n  config.eager_load = false\n\n  # Configure static asset server for tests with Cache-Control for performance.\n  if Gem::Version.new(Rails.version) < Gem::Version.new(5)\n    config.serve_static_files  = true\n    config.static_cache_control = \"public, max-age=3600\"\n  else\n    config.public_file_server.enabled = true\n    config.public_file_server.headers = \"public, max-age=3600\"\n  end\n\n  # Show full error reports and disable caching.\n  config.consider_all_requests_local       = true\n  config.action_controller.perform_caching = false\n\n  # Raise exceptions instead of rendering exception templates.\n  config.action_dispatch.show_exceptions = false\n\n  # Disable request forgery protection in test environment.\n  config.action_controller.allow_forgery_protection = false\n\n  # Tell Action Mailer not to deliver emails to the real world.\n  # The :test delivery method accumulates sent emails in the\n  # ActionMailer::Base.deliveries array.\n  config.action_mailer.delivery_method = :test\n\n  # Print deprecation notices to the stderr.\n  config.active_support.deprecation = :stderr\nend\n"
  },
  {
    "path": "spec/dummy/config/initializers/backtrace_silencers.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.\n# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }\n\n# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.\n# Rails.backtrace_cleaner.remove_silencers!\n"
  },
  {
    "path": "spec/dummy/config/initializers/filter_parameter_logging.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# Configure sensitive parameters which will be filtered from the log file.\nRails.application.config.filter_parameters += [:password]\n"
  },
  {
    "path": "spec/dummy/config/initializers/inflections.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# Add new inflection rules using the following format. Inflections\n# are locale specific, and you may define rules for as many different\n# locales as you wish. All of these examples are active by default:\n# ActiveSupport::Inflector.inflections(:en) do |inflect|\n#   inflect.plural /^(ox)$/i, '\\1en'\n#   inflect.singular /^(ox)en/i, '\\1'\n#   inflect.irregular 'person', 'people'\n#   inflect.uncountable %w( fish sheep )\n# end\n\n# These inflection rules are supported but not enabled by default:\n# ActiveSupport::Inflector.inflections(:en) do |inflect|\n#   inflect.acronym 'RESTful'\n# end\n"
  },
  {
    "path": "spec/dummy/config/initializers/mime_types.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# Add new mime types for use in respond_to blocks:\n# Mime::Type.register \"text/richtext\", :rtf\n# Mime::Type.register_alias \"text/html\", :iphone\n"
  },
  {
    "path": "spec/dummy/config/initializers/secret_token.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# Your secret key is used for verifying the integrity of signed cookies.\n# If you change this key, all old signed cookies will become invalid!\n\n# Make sure the secret is at least 30 characters and all random,\n# no regular words or you'll be exposed to dictionary attacks.\n# You can use `rake secret` to generate a secure secret key.\n\n# Make sure your secret_key_base is kept private\n# if you're sharing your code publicly.\nDummy::Application.config.secret_key_base = 'f98fee0850aaebc8971433d0397b6c79309df33a5e2a24276c89f5457d4ba65b0386d6657f2eb65411b5a5e429114b45b7f92f8300762331a677d3747f774190'\n"
  },
  {
    "path": "spec/dummy/config/initializers/session_store.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\nDummy::Application.config.session_store :cookie_store, key: '_dummy_session'\n"
  },
  {
    "path": "spec/dummy/config/initializers/wrap_parameters.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# This file contains settings for ActionController::ParamsWrapper which\n# is enabled by default.\n\n# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.\nActiveSupport.on_load(:action_controller) do\n  wrap_parameters format: [:json] if respond_to?(:wrap_parameters)\nend\n\n# To enable root element in JSON for ActiveRecord objects.\n# ActiveSupport.on_load(:active_record) do\n#  self.include_root_in_json = true\n# end\n"
  },
  {
    "path": "spec/dummy/config/locales/en.yml",
    "content": "# Files in the config/locales directory are used for internationalization\n# and are automatically loaded by Rails. If you want to use locales other\n# than English, add the necessary files in this directory.\n#\n# To use the locales, use `I18n.t`:\n#\n#     I18n.t 'hello'\n#\n# In views, this is aliased to just `t`:\n#\n#     <%= t('hello') %>\n#\n# To use a different locale, set it with `I18n.locale`:\n#\n#     I18n.locale = :es\n#\n# This would use the information in config/locales/es.yml.\n#\n# To learn more, please read the Rails Internationalization guide\n# available at http://guides.rubyonrails.org/i18n.html.\n\nen:\n  hello: \"Hello world\"\n"
  },
  {
    "path": "spec/dummy/config/routes.rb",
    "content": "Dummy::Application.routes.draw do\n  resources :items\n  resources :sequenced_items\n  get 'multiple_classes', to: 'multiple_classes#index'\nend\n"
  },
  {
    "path": "spec/dummy/config.ru",
    "content": "# This file is used by Rack-based servers to start the application.\n\nrequire ::File.expand_path('../config/environment',  __FILE__)\nrun Rails.application\n"
  },
  {
    "path": "spec/dummy/db/migrate/20131223124841_create_items.rb",
    "content": "class CreateItems < Dummy::MigrationClass\n  def change\n    create_table :items do |t|\n      t.string :title\n      t.integer :sort\n\n      t.timestamps null: false\n    end\n  end\nend\n"
  },
  {
    "path": "spec/dummy/db/migrate/20170414031946_create_sequenced_items.rb",
    "content": "class CreateSequencedItems < Dummy::MigrationClass\n  def change\n    create_table :sequenced_items do |t|\n      t.string :title\n      t.integer :sequence\n\n      t.timestamps null: false\n    end\n  end\nend\n"
  },
  {
    "path": "spec/dummy/db/migrate/20180427061457_create_multiple_classes.rb",
    "content": "class CreateMultipleClasses < Dummy::MigrationClass\n  def change\n    create_table :first_items do |t|\n      t.string :title\n      t.integer :sort\n\n      t.timestamps null: false\n    end\n    create_table :second_items do |t|\n      t.string :title\n      t.integer :sort\n\n      t.timestamps null: false\n    end\n  end\nend\n"
  },
  {
    "path": "spec/dummy/db/seeds.rb",
    "content": "Item.delete_all\n10.times {|i| Item.create! title: \"Title#{i}\", sort: i }\n\nSequencedItem.delete_all\n10.times {|i| SequencedItem.create! title: \"OtherTitle#{i}\", sequence: i }\n\nFirstItem.delete_all\n(0..4).each {|i| FirstItem.create! title: \"FirstTitle#{i}\", sort: i }\nSecondItem.delete_all\n(5..9).each {|i| SecondItem.create! title: \"SecondTitle#{i}\", sort: i }"
  },
  {
    "path": "spec/dummy/lib/assets/.keep",
    "content": ""
  },
  {
    "path": "spec/dummy/log/.keep",
    "content": ""
  },
  {
    "path": "spec/dummy/public/404.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <title>The page you were looking for doesn't exist (404)</title>\n  <style>\n  body {\n    background-color: #EFEFEF;\n    color: #2E2F30;\n    text-align: center;\n    font-family: arial, sans-serif;\n  }\n\n  div.dialog {\n    width: 25em;\n    margin: 4em auto 0 auto;\n    border: 1px solid #CCC;\n    border-right-color: #999;\n    border-left-color: #999;\n    border-bottom-color: #BBB;\n    border-top: #B00100 solid 4px;\n    border-top-left-radius: 9px;\n    border-top-right-radius: 9px;\n    background-color: white;\n    padding: 7px 4em 0 4em;\n  }\n\n  h1 {\n    font-size: 100%;\n    color: #730E15;\n    line-height: 1.5em;\n  }\n\n  body > p {\n    width: 33em;\n    margin: 0 auto 1em;\n    padding: 1em 0;\n    background-color: #F7F7F7;\n    border: 1px solid #CCC;\n    border-right-color: #999;\n    border-bottom-color: #999;\n    border-bottom-left-radius: 4px;\n    border-bottom-right-radius: 4px;\n    border-top-color: #DADADA;\n    color: #666;\n    box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);\n  }\n  </style>\n</head>\n\n<body>\n  <!-- This file lives in public/404.html -->\n  <div class=\"dialog\">\n    <h1>The page you were looking for doesn't exist.</h1>\n    <p>You may have mistyped the address or the page may have moved.</p>\n  </div>\n  <p>If you are the application owner check the logs for more information.</p>\n</body>\n</html>\n"
  },
  {
    "path": "spec/dummy/public/422.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <title>The change you wanted was rejected (422)</title>\n  <style>\n  body {\n    background-color: #EFEFEF;\n    color: #2E2F30;\n    text-align: center;\n    font-family: arial, sans-serif;\n  }\n\n  div.dialog {\n    width: 25em;\n    margin: 4em auto 0 auto;\n    border: 1px solid #CCC;\n    border-right-color: #999;\n    border-left-color: #999;\n    border-bottom-color: #BBB;\n    border-top: #B00100 solid 4px;\n    border-top-left-radius: 9px;\n    border-top-right-radius: 9px;\n    background-color: white;\n    padding: 7px 4em 0 4em;\n  }\n\n  h1 {\n    font-size: 100%;\n    color: #730E15;\n    line-height: 1.5em;\n  }\n\n  body > p {\n    width: 33em;\n    margin: 0 auto 1em;\n    padding: 1em 0;\n    background-color: #F7F7F7;\n    border: 1px solid #CCC;\n    border-right-color: #999;\n    border-bottom-color: #999;\n    border-bottom-left-radius: 4px;\n    border-bottom-right-radius: 4px;\n    border-top-color: #DADADA;\n    color: #666;\n    box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);\n  }\n  </style>\n</head>\n\n<body>\n  <!-- This file lives in public/422.html -->\n  <div class=\"dialog\">\n    <h1>The change you wanted was rejected.</h1>\n    <p>Maybe you tried to change something you didn't have access to.</p>\n  </div>\n  <p>If you are the application owner check the logs for more information.</p>\n</body>\n</html>\n"
  },
  {
    "path": "spec/dummy/public/500.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <title>We're sorry, but something went wrong (500)</title>\n  <style>\n  body {\n    background-color: #EFEFEF;\n    color: #2E2F30;\n    text-align: center;\n    font-family: arial, sans-serif;\n  }\n\n  div.dialog {\n    width: 25em;\n    margin: 4em auto 0 auto;\n    border: 1px solid #CCC;\n    border-right-color: #999;\n    border-left-color: #999;\n    border-bottom-color: #BBB;\n    border-top: #B00100 solid 4px;\n    border-top-left-radius: 9px;\n    border-top-right-radius: 9px;\n    background-color: white;\n    padding: 7px 4em 0 4em;\n  }\n\n  h1 {\n    font-size: 100%;\n    color: #730E15;\n    line-height: 1.5em;\n  }\n\n  body > p {\n    width: 33em;\n    margin: 0 auto 1em;\n    padding: 1em 0;\n    background-color: #F7F7F7;\n    border: 1px solid #CCC;\n    border-right-color: #999;\n    border-bottom-color: #999;\n    border-bottom-left-radius: 4px;\n    border-bottom-right-radius: 4px;\n    border-top-color: #DADADA;\n    color: #666;\n    box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);\n  }\n  </style>\n</head>\n\n<body>\n  <!-- This file lives in public/500.html -->\n  <div class=\"dialog\">\n    <h1>We're sorry, but something went wrong.</h1>\n  </div>\n  <p>If you are the application owner check the logs for more information.</p>\n</body>\n</html>\n"
  },
  {
    "path": "spec/models/rails_sortable/model_spec.rb",
    "content": "require 'spec_helper'\n\ndescribe RailsSortable::Model, type: :model do\n  describe \"before_create\" do\n    context \"when sort is nil\" do\n      it \"should be automatically set maximum sort value\" do\n        Item.create! sort: 1000\n        new_item = Item.create!\n        expect(new_item.sort).to eql 1001\n      end\n    end\n    context \"when sort has value\" do\n      it \"should not set sort value\" do\n        item = Item.create! sort: 1000\n        expect(item.sort).to eql 1000\n      end\n    end\n  end\n\n  describe \"set_sortable\" do\n    describe \"attribute\" do\n      it \"should change sort_attribute\" do\n        other_item = SequencedItem.create!\n        expect(other_item.sequence).to eql(1)\n      end\n    end\n\n    describe \"without_updating_timestamps\" do\n      context \"when optional value is true\" do\n        before do\n          Item.class_eval do\n            set_sortable :sort, without_updating_timestamps: true\n          end\n        end\n        it \"should NOT modify timestamps\" do\n          item = Item.create!\n          expect { item.update_sort!(1000) }.to_not change(item, :updated_at)\n        end\n      end\n\n      context \"when optional value is NOT true\" do\n        before do\n          Item.class_eval do\n            set_sortable :sort, without_updating_timestamps: false\n          end\n        end\n        it \"should modify timestamps\" do\n          item = Item.create!\n          expect { item.update_sort!(1000) }.to change(item, :updated_at)\n        end\n      end\n    end\n\n    describe \"without_validations\" do\n      context \"when optional value is true\" do\n        before do\n          ValidatedItem.class_eval do\n            set_sortable :sort, without_validations: true\n          end\n        end\n\n        it \"will skip validations\" do\n          item = ValidatedItem.create!(title: \"Title\")\n          item.update_attribute(:title, nil)\n          expect { item.update_sort!(1000) }.not_to raise_error\n        end\n      end\n\n      context \"when optional value is false\" do\n        before do\n          ValidatedItem.class_eval do\n            set_sortable :sort, without_validations: false\n          end\n        end\n\n        it \"will require validations\" do\n          item = ValidatedItem.create!(title: \"Title\")\n          item.update_attribute(:title, nil)\n          expect do\n            item.update_sort!(1000)\n          end.to raise_error(ActiveRecord::RecordInvalid, /Title can't be blank/)\n        end\n      end\n    end\n  end\n\n  describe \"sortable_id\" do\n    it \"should return a correct sortable_id\" do\n      item = Item.create!\n      expect(item.sortable_id).to eq(SortableController::VERIFIER.generate(\"class=Item,id=#{item.to_param}\"))\n    end\n  end\n\n  describe \"each_with_sortable_id\" do\n    it \"should make models iterable with sortable ids\" do\n      items = 2.times.map { |i| Item.create! sort: i }\n      expect { |b| Item.order(:sort).each_with_sortable_id(&b) }.to yield_successive_args(\n        [items[0], SortableController::VERIFIER.generate(\"class=Item,id=#{items[0].to_param}\")],\n        [items[1], SortableController::VERIFIER.generate(\"class=Item,id=#{items[1].to_param}\")],\n      )\n    end\n  end\nend\n"
  },
  {
    "path": "spec/spec_helper.rb",
    "content": "# This file is copied to spec/ when you run 'rails generate rspec:install'\nENV[\"RAILS_ENV\"] ||= 'test'\nrequire File.expand_path(\"../dummy/config/environment\", __FILE__)\nrequire 'rspec/rails'\n\n# Requires supporting ruby files with custom matchers and macros, etc,\n# in spec/support/ and its subdirectories.\nDir[Rails.root.join(\"spec/support/**/*.rb\")].each { |f| require f }\n\n# Checks for pending migrations before tests are run.\n# If you are not using ActiveRecord, you can remove this line.\nActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)\n\nRSpec.configure do |config|\n  # ## Mock Framework\n  #\n  # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:\n  #\n  # config.mock_with :mocha\n  # config.mock_with :flexmock\n  # config.mock_with :rr\n\n  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures\n  config.fixture_path = \"#{::Rails.root}/spec/fixtures\"\n\n  # If you're not using ActiveRecord, or you'd prefer not to run each of your\n  # examples within a transaction, remove the following line or assign false\n  # instead of true.\n  config.use_transactional_fixtures = true\n\n  # If true, the base class of anonymous controllers will be inferred\n  # automatically. This will be the default behavior in future versions of\n  # rspec-rails.\n  config.infer_base_class_for_anonymous_controllers = false\n\n  # Run specs in random order to surface order dependencies. If you find an\n  # order dependency and want to debug it, you can fix the order by providing\n  # the seed, which is printed after each run.\n  #     --seed 1234\n  config.order = \"random\"\nend\n\n# Workaround for ThreadError: already initialized with Ruby 2.6.0\n# See https://github.com/rails/rails/issues/34790\nif RUBY_VERSION >= '2.6.0'\n  if Rails.version < '5'\n    class ActionController::TestResponse < ActionDispatch::TestResponse\n      def recycle!\n        # hack to avoid MonitorMixin double-initialize error:\n        @mon_mutex_owner_object_id = nil\n        @mon_mutex = nil\n        initialize\n      end\n    end\n  else\n    puts \"Monkeypatch for ActionController::TestResponse no longer needed\"\n  end\nend"
  },
  {
    "path": "vendor/assets/javascripts/plugin.js",
    "content": "(function($) {\n\n  $.fn.railsSortable = function(options) {\n    options = options || {};\n    var settings = $.extend({}, options);\n    \n    settings.baseUrl = settings.baseUrl || '';\n\n    settings.update = function(event, ui) {\n      if (typeof options.update === 'function') {\n        options.update(event, ui);\n      }\n\n      $.ajax({\n        type: 'POST',\n        url: settings.baseUrl + '/sortable/reorder',\n        dataType: 'json',\n        contentType: 'application/json',\n        data: JSON.stringify({\n          rails_sortable: $(this).sortable('toArray'),\n        }),\n      });\n    }\n\n    this.sortable(settings);\n  };\n})(jQuery);\n"
  },
  {
    "path": "vendor/assets/javascripts/rails_sortable.js",
    "content": "//= require_tree .\n"
  }
]