From f12925887cd7a52e42d7d0dd38367cc1946bf6c8 Mon Sep 17 00:00:00 2001 From: Stephan Kaag Date: Mon, 17 Feb 2014 17:44:28 +0100 Subject: [PATCH] Drop Rails3 support --- Gemfile | 57 +- Gemfile.lock | 329 +++++------- Gemfile_rails4.lock | 470 ----------------- Gemfile_rails_master.lock | 490 ------------------ app/models/category.rb | 17 +- app/models/discourse_version_check.rb | 14 +- app/models/incoming_links_report.rb | 1 - app/models/invite.rb | 2 +- app/models/topic.rb | 4 - app/models/topic_featured_users.rb | 1 - app/models/user_email_observer.rb | 6 +- config/application.rb | 15 - config/environments/development.rb | 6 +- config/environments/production.rb | 8 +- config/environments/profile.rb | 2 +- config/environments/test.rb | 3 +- ...0121123054127_make_post_number_distinct.rb | 6 - lib/discourse_observer.rb | 21 +- lib/freedom_patches/active_record_base.rb | 14 - lib/freedom_patches/active_record_relation.rb | 14 - lib/freedom_patches/arel_patch.rb | 12 +- lib/freedom_patches/performance_fixes.rb | 28 +- lib/freedom_patches/rails_security_fixes.rb | 127 ----- lib/trashable.rb | 10 +- lib/validators/ip_address_format_validator.rb | 26 +- spec/controllers/static_controller_spec.rb | 12 +- .../rails_multisite/connection_management.rb | 12 +- 27 files changed, 185 insertions(+), 1522 deletions(-) delete mode 100644 Gemfile_rails4.lock delete mode 100644 Gemfile_rails_master.lock delete mode 100644 lib/freedom_patches/active_record_relation.rb delete mode 100644 lib/freedom_patches/rails_security_fixes.rb diff --git a/Gemfile b/Gemfile index 535620e83c5..c69a84cc54f 100644 --- a/Gemfile +++ b/Gemfile @@ -11,59 +11,38 @@ module Bundler::SharedHelpers end module ::Kernel - def rails4? - !ENV["RAILS3"] - end - def rails_master? - rails4? && ENV["RAILS_MASTER"] + ENV["RAILS_MASTER"] end end -if rails4? - rails_version = rails_master? ? 'rails_master' : 'rails4' +if rails_master? + Bundler::SharedHelpers.default_lockfile = Pathname.new("#{Bundler::SharedHelpers.default_gemfile}_master.lock") +end - Bundler::SharedHelpers.default_lockfile = Pathname.new("#{Bundler::SharedHelpers.default_gemfile}_#{rails_version}.lock") - - # Bundler::Dsl.evaluate already called with an incorrect lockfile ... fix it - class Bundler::Dsl - # A bit messy, this can be called multiple times by bundler, avoid blowing the stack - unless self.method_defined? :to_definition_unpatched - alias_method :to_definition_unpatched, :to_definition - end - def to_definition(bad_lockfile, unlock) - to_definition_unpatched(Bundler::SharedHelpers.default_lockfile, unlock) - end +# Bundler::Dsl.evaluate already called with an incorrect lockfile ... fix it +class Bundler::Dsl + # A bit messy, this can be called multiple times by bundler, avoid blowing the stack + unless self.method_defined? :to_definition_unpatched + alias_method :to_definition_unpatched, :to_definition + end + def to_definition(bad_lockfile, unlock) + to_definition_unpatched(Bundler::SharedHelpers.default_lockfile, unlock) end -else - # Note to be deprecated, in place of a dual boot master - puts "Booting in Rails 3 mode" end # see: https://github.com/mbleigh/seed-fu/pull/54 # taking forever to get changes upstream in seed-fu gem 'seed-fu-discourse', require: 'seed-fu' -if rails4? - if rails_master? - gem 'rails', git: 'https://github.com/rails/rails.git' - gem 'actionpack-action_caching', git: 'https://github.com/rails/actionpack-action_caching.git' - else - gem 'rails' - gem 'actionpack-action_caching' - end - gem 'rails-observers' +if rails_master? + gem 'rails', git: 'https://github.com/rails/rails.git' + gem 'actionpack-action_caching', git: 'https://github.com/rails/actionpack-action_caching.git' else - # we had pain with the 3.2.13 upgrade so monkey patch the security fix - # next time around we hope to upgrade - gem 'rails', '3.2.12' - gem 'strong_parameters' # remove when we upgrade to Rails 4 - # we are using a custom sprockets repo to work around: https://github.com/rails/rails/issues/8099#issuecomment-16137638 - # REVIEW EVERY RELEASE - gem 'sprockets', git: 'https://github.com/SamSaffron/sprockets.git', branch: 'rails-compat' - gem 'activerecord-postgres-hstore' - gem 'active_attr' + gem 'rails' + gem 'actionpack-action_caching' end +gem 'rails-observers' #gem 'redis-rails' gem 'hiredis' diff --git a/Gemfile.lock b/Gemfile.lock index 8d2536edea7..3d44896f89a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,54 +1,3 @@ -GIT - remote: git://github.com/SamSaffron/seed-fu.git - revision: 502c8b8514df3bf028c9231cc3a6ea3cff4f37f0 - specs: - seed-fu (2.2.0) - activerecord (>= 3.1, < 4.1) - activesupport (>= 3.1, < 4.1) - -GIT - remote: git://github.com/sporkrb/spork-rails.git - revision: 0dd45e59d3237b4c8f9efc215b46d9c07072a95e - specs: - spork-rails (4.0.0) - rails (>= 3.0.0, < 5) - spork (>= 1.0rc0) - -GIT - remote: https://github.com/SamSaffron/sprockets.git - revision: bacf2ec4d4d10cd8d1ab25a6360740314c512237 - branch: rails-compat - specs: - sprockets (2.2.3) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - -GIT - remote: https://github.com/SamSaffron/vestal_versions - revision: 007b30a5274db7db55da745a4482243559247782 - specs: - vestal_versions (1.2.3) - activerecord (> 3.0) - activesupport (> 3.0) - -GIT - remote: https://github.com/callahad/omniauth-browserid.git - revision: af62d667626c1622de6fe13b60849c3640765ab1 - branch: observer_api - specs: - omniauth-browserid (0.0.2) - faraday - multi_json - omniauth (~> 1.0) - -GIT - remote: https://github.com/lawrencepit/email_reply_parser.git - revision: 67408dfb1b99fb8d5f145f782b9e22d1851a8e5a - specs: - email_reply_parser (0.6) - PATH remote: vendor/gems/discourse_plugin specs: @@ -59,51 +8,37 @@ PATH specs: rails_multisite (0.0.1) -PATH - remote: vendor/gems/simple_handlebars_rails - specs: - simple_handlebars_rails (0.0.1) - rails (> 3.1) - GEM remote: https://rubygems.org/ specs: - actionmailer (3.2.12) - actionpack (= 3.2.12) - mail (~> 2.4.4) - actionpack (3.2.12) - activemodel (= 3.2.12) - activesupport (= 3.2.12) - builder (~> 3.0.0) + actionmailer (4.0.2) + actionpack (= 4.0.2) + mail (~> 2.5.4) + actionpack (4.0.2) + activesupport (= 4.0.2) + builder (~> 3.1.0) erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - active_attr (0.8.2) - activemodel (>= 3.0.2, < 4.1) - activesupport (>= 3.0.2, < 4.1) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + actionpack-action_caching (1.1.1) + actionpack (>= 4.0.0, < 5.0) active_model_serializers (0.8.1) activemodel (>= 3.0) - activemodel (3.2.12) - activesupport (= 3.2.12) - builder (~> 3.0.0) - activerecord (3.2.12) - activemodel (= 3.2.12) - activesupport (= 3.2.12) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activerecord-postgres-hstore (0.7.7) - activerecord (>= 3.1) - pg-hstore (>= 1.1.5) - rake - activeresource (3.2.12) - activemodel (= 3.2.12) - activesupport (= 3.2.12) - activesupport (3.2.12) - i18n (~> 0.6) - multi_json (~> 1.0) + activemodel (4.0.2) + activesupport (= 4.0.2) + builder (~> 3.1.0) + activerecord (4.0.2) + activemodel (= 4.0.2) + activerecord-deprecated_finders (~> 1.0.2) + activesupport (= 4.0.2) + arel (~> 4.0.0) + activerecord-deprecated_finders (1.0.3) + activesupport (4.0.2) + i18n (~> 0.6, >= 0.6.4) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) addressable (2.3.5) airbrake (3.1.2) activesupport @@ -111,7 +46,8 @@ GEM annotate (2.6.0) activerecord (>= 2.3.0) rake (>= 0.8.7) - arel (3.0.3) + arel (4.0.2) + atomic (1.1.14) barber (0.4.2) ember-source execjs @@ -121,7 +57,7 @@ GEM erubis (>= 2.6.6) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) - builder (3.0.4) + builder (3.1.4) celluloid (0.15.2) timers (~> 1.1.0) certified (0.1.1) @@ -129,9 +65,8 @@ GEM connection_pool (1.2.0) daemons (1.1.9) debug_inspector (0.0.2) - diff-lcs (1.2.5) - diffy (3.0.1) - docile (1.1.1) + diff-lcs (1.2.4) + email_reply_parser-discourse (0.6) ember-data-source (0.14) ember-source ember-rails (0.14.1) @@ -150,11 +85,13 @@ GEM excon (0.28.0) execjs (2.0.2) exifr (1.1.3) - fabrication (2.9.3) + fabrication (2.8.1) fakeweb (1.3.0) faraday (0.8.8) multipart-post (~> 1.2.0) - fast_blank (0.0.2) + fast_blank (0.0.1) + rake + rake-compiler fast_stack (0.1.0) rake rake-compiler @@ -162,8 +99,7 @@ GEM rake rake-compiler fast_xs (0.8.0) - fastimage (1.5.4) - addressable (~> 2.3, >= 2.3.5) + fastimage (1.5.2) ffi (1.9.3) flamegraph (0.0.5) fast_stack @@ -178,29 +114,27 @@ GEM nokogiri (~> 1.5) ruby-hmac formatador (0.2.4) - fspath (2.0.6) + fspath (2.0.5) given_core (3.1.1) sorcerer (>= 0.3.7) + guess_html_encoding (0.0.9) handlebars-source (1.1.2) hashie (2.0.5) + hexpress (1.2.0) highline (1.6.20) hike (1.2.3) hiredis (0.4.5) - html_truncator (0.3.1) - nokogiri (~> 1.5) httpauth (0.2.0) i18n (0.6.9) - ice_cube (0.11.1) image_optim (0.9.1) exifr (~> 1.1.3) fspath (~> 2.0.5) image_size (~> 1.1.2) in_threads (~> 1.2.0) progress (~> 3.0.0) - image_size (1.1.4) + image_size (1.1.3) image_sorcery (1.1.0) in_threads (1.2.0) - journey (1.0.4) jquery-rails (3.0.4) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) @@ -214,8 +148,7 @@ GEM libv8 (3.16.14.3) listen (0.7.3) lru_redux (0.8.1) - mail (2.4.4) - i18n (>= 0.4.0) + mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) message_bus (0.9.3.2) @@ -226,18 +159,19 @@ GEM method_source (0.8.2) mime-types (1.25.1) mini_portile (0.5.2) - minitest (5.1.0) + minitest (4.7.5) mocha (0.14.0) metaclass (~> 0.0.1) - mock_redis (0.10.0) + mock_redis (0.9.0) + moneta (0.7.20) msgpack (0.5.7) - multi_json (1.8.2) + multi_json (1.8.4) multipart-post (1.2.0) - mustache (0.99.5) + mustache (0.99.4) net-scp (1.1.2) net-ssh (>= 2.6.5) net-ssh (2.7.0) - nokogiri (1.6.0) + nokogiri (1.6.1) mini_portile (~> 0.5.0) oauth (0.4.7) oauth2 (0.8.1) @@ -246,15 +180,11 @@ GEM jwt (~> 0.1.4) multi_json (~> 1.0) rack (~> 1.2) - oj (2.3.0) + oj (2.2.3) omniauth (1.1.4) hashie (>= 1.2, < 3) rack - omniauth-cas (1.0.4) - addressable (~> 2.3) - nokogiri (~> 1.6) - omniauth (~> 1.1.0) - omniauth-facebook (1.5.1) + omniauth-facebook (1.4.1) omniauth-oauth2 (~> 1.1.0) omniauth-github (1.1.1) omniauth (~> 1.0) @@ -271,11 +201,20 @@ GEM omniauth-twitter (1.0.1) multi_json (~> 1.3) omniauth-oauth (~> 1.0) + onebox (1.2.0) + hexpress (~> 1.2) + moneta (~> 0.7) + multi_json (~> 1.7) + mustache (~> 0.99) + nokogiri (~> 1.6.1) + opengraph_parser (~> 0.2.3) + opengraph_parser (0.2.3) + addressable + nokogiri openid-redis-store (0.0.2) redis ruby-openid - pg (0.17.0) - pg-hstore (1.2.0) + pg (0.15.1) polyglot (0.3.3) progress (3.0.0) pry (0.9.12.4) @@ -286,14 +225,13 @@ GEM pry (~> 0.9.10) pry-rails (0.3.2) pry (>= 0.9.10) - puma (2.7.1) + puma (2.6.0) rack (>= 1.1, < 2.0) qunit-rails (0.0.4) railties (>= 3.2.3) - rack (1.4.5) - rack-cache (1.2) - rack (>= 0.4) - rack-cors (0.2.9) + rack (1.5.2) + rack-cors (0.2.8) + rack rack-mini-profiler (0.9.0.pre) rack (>= 1.1.3) rack-openid (1.3.1) @@ -301,58 +239,38 @@ GEM ruby-openid (>= 2.1.8) rack-protection (1.5.1) rack - rack-ssl (1.3.3) - rack rack-test (0.6.2) rack (>= 1.0) - rails (3.2.12) - actionmailer (= 3.2.12) - actionpack (= 3.2.12) - activerecord (= 3.2.12) - activeresource (= 3.2.12) - activesupport (= 3.2.12) - bundler (~> 1.0) - railties (= 3.2.12) - railties (3.2.12) - actionpack (= 3.2.12) - activesupport (= 3.2.12) - rack-ssl (~> 1.3.2) + rails (4.0.2) + actionmailer (= 4.0.2) + actionpack (= 4.0.2) + activerecord (= 4.0.2) + activesupport (= 4.0.2) + bundler (>= 1.3.0, < 2.0) + railties (= 4.0.2) + sprockets-rails (~> 2.0.0) + rails-observers (0.1.2) + activemodel (~> 4.0) + railties (4.0.2) + actionpack (= 4.0.2) + activesupport (= 4.0.2) rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) + thor (>= 0.18.1, < 2.0) raindrops (0.12.0) - rake (10.1.0) + rake (10.1.1) rake-compiler (0.9.2) rake rb-fsevent (0.9.3) rb-inotify (0.9.2) ffi (>= 0.5.0) - rbtrace (0.4.2) + rbtrace (0.4.1) ffi (>= 1.0.6) msgpack (>= 0.4.3) trollop (>= 1.16.2) - rdoc (3.12.2) - json (~> 1.4) redcarpet (3.0.0) redis (3.0.6) - redis-actionpack (3.2.4) - actionpack (~> 3.2.0) - redis-rack (~> 1.4.4) - redis-store (~> 1.1.4) - redis-activesupport (3.2.4) - activesupport (~> 3.2.0) - redis-store (~> 1.1.0) - redis-namespace (1.4.1) + redis-namespace (1.3.2) redis (~> 3.0.4) - redis-rack (1.4.4) - rack (~> 1.4.0) - redis-store (~> 1.1.4) - redis-rails (3.2.4) - redis-actionpack (~> 3.2.4) - redis-activesupport (~> 3.2.4) - redis-store (~> 1.1.4) - redis-store (1.1.4) - redis (>= 2.2) ref (1.0.5) rest-client (1.6.7) mime-types (>= 1.16) @@ -361,8 +279,8 @@ GEM rspec-core (~> 2.14.0) rspec-expectations (~> 2.14.0) rspec-mocks (~> 2.14.0) - rspec-core (2.14.7) - rspec-expectations (2.14.4) + rspec-core (2.14.6) + rspec-expectations (2.14.3) diff-lcs (>= 1.1.3, < 2.0) rspec-given (3.1.1) given_core (= 3.1.1) @@ -377,17 +295,23 @@ GEM rspec-mocks (~> 2.14.0) ruby-hmac (0.4.0) ruby-openid (2.3.0) + ruby-readability (0.6.0) + guess_html_encoding (>= 0.0.4) + nokogiri (>= 1.4.2) sanitize (2.0.6) nokogiri (>= 1.4.4) sass (3.2.12) - sass-rails (3.2.6) - railties (~> 3.2.0) + sass-rails (4.0.1) + railties (>= 4.0.0, < 5.0) sass (>= 3.1.10) - tilt (~> 1.3) + sprockets-rails (~> 2.0.0) + seed-fu-discourse (2.2.0) + activerecord (>= 3.1, < 4.1) + activesupport (>= 3.1, < 4.1) shoulda (3.5.0) shoulda-context (~> 1.0, >= 1.0.1) shoulda-matchers (>= 1.4.1, < 3.0) - shoulda-context (1.1.6) + shoulda-context (1.1.5) shoulda-matchers (2.4.0) activesupport (>= 3.0.0) sidekiq (2.15.1) @@ -398,31 +322,35 @@ GEM redis-namespace (>= 1.3.1) sidekiq-failures (0.2.2) sidekiq (>= 2.9.0) - sidetiq (0.4.3) - celluloid (>= 0.14.1) - ice_cube (~> 0.11.0) - sidekiq (~> 2.15.0) - simplecov (0.8.2) - docile (~> 1.1.0) - multi_json - simplecov-html (~> 0.8.0) - simplecov-html (0.8.0) + simple-rss (1.3.1) + simplecov (0.7.1) + multi_json (~> 1.0) + simplecov-html (~> 0.7.1) + simplecov-html (0.7.1) sinatra (1.4.4) rack (~> 1.4) rack-protection (~> 1.4) tilt (~> 1.3, >= 1.3.4) - slim (2.0.2) + slim (2.0.1) temple (~> 0.6.6) tilt (>= 1.3.3, < 2.1) slop (3.4.7) sorcerer (1.0.2) spork (1.0.0rc4) - strong_parameters (0.2.1) - actionpack (~> 3.0) - activemodel (~> 3.0) - railties (~> 3.0) + spork-rails (4.0.0) + rails (>= 3.0.0, < 5) + spork (>= 1.0rc0) + sprockets (2.10.1) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sprockets-rails (2.0.1) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (~> 2.8) temple (0.6.7) - therubyracer (0.12.0) + therubyracer (0.12.1) libv8 (~> 3.16.14.0) ref thin (1.6.1) @@ -430,15 +358,17 @@ GEM eventmachine (>= 1.0.0) rack (>= 1.0.0) thor (0.18.1) + thread_safe (0.1.3) + atomic tilt (1.4.1) - timecop (0.7.0) + timecop (0.6.3) timers (1.1.0) treetop (1.4.15) polyglot polyglot (>= 0.3.1) trollop (2.0) tzinfo (0.3.38) - uglifier (2.3.2) + uglifier (2.3.1) execjs (>= 0.3.0) json (>= 1.8.0) unf (0.1.3) @@ -453,18 +383,16 @@ PLATFORMS ruby DEPENDENCIES - active_attr + actionpack-action_caching active_model_serializers - activerecord-postgres-hstore airbrake (= 3.1.2) annotate barber better_errors binding_of_caller certified - diffy (>= 3.0) discourse_plugin! - email_reply_parser! + email_reply_parser-discourse ember-rails ember-source (~> 1.2.0.1) eventmachine @@ -479,7 +407,6 @@ DEPENDENCIES handlebars-source (~> 1.1.2) highline hiredis - html_truncator image_optim image_sorcery librarian (>= 0.0.25) @@ -494,23 +421,23 @@ DEPENDENCIES nokogiri oj omniauth - omniauth-browserid! - omniauth-cas omniauth-facebook omniauth-github omniauth-oauth2 omniauth-openid omniauth-twitter + onebox openid-redis-store - pg + pg (= 0.15.1) pry-nav pry-rails puma qunit-rails rack-cors - rack-mini-profiler (= 0.9.0.pre) + rack-mini-profiler rack-protection - rails (= 3.2.12) + rails + rails-observers rails_multisite! rake rb-fsevent @@ -518,30 +445,26 @@ DEPENDENCIES rbtrace redcarpet redis - redis-rails rest-client rinku rspec-given rspec-rails + ruby-readability sanitize sass sass-rails - seed-fu! + seed-fu-discourse shoulda sidekiq (= 2.15.1) sidekiq-failures - sidetiq (>= 0.3.6) - simple_handlebars_rails! + simple-rss simplecov sinatra slim - spork-rails! - sprockets! - strong_parameters + spork-rails therubyracer thin timecop uglifier unf unicorn - vestal_versions! diff --git a/Gemfile_rails4.lock b/Gemfile_rails4.lock deleted file mode 100644 index e87fbb77c1c..00000000000 --- a/Gemfile_rails4.lock +++ /dev/null @@ -1,470 +0,0 @@ -PATH - remote: vendor/gems/discourse_plugin - specs: - discourse_plugin (0.0.1) - -PATH - remote: vendor/gems/rails_multisite - specs: - rails_multisite (0.0.1) - -GEM - remote: https://rubygems.org/ - specs: - actionmailer (4.0.2) - actionpack (= 4.0.2) - mail (~> 2.5.4) - actionpack (4.0.2) - activesupport (= 4.0.2) - builder (~> 3.1.0) - erubis (~> 2.7.0) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - actionpack-action_caching (1.0.0) - actionpack (>= 4.0.0.beta, < 5.0) - active_model_serializers (0.8.1) - activemodel (>= 3.0) - activemodel (4.0.2) - activesupport (= 4.0.2) - builder (~> 3.1.0) - activerecord (4.0.2) - activemodel (= 4.0.2) - activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.2) - arel (~> 4.0.0) - activerecord-deprecated_finders (1.0.3) - activesupport (4.0.2) - i18n (~> 0.6, >= 0.6.4) - minitest (~> 4.2) - multi_json (~> 1.3) - thread_safe (~> 0.1) - tzinfo (~> 0.3.37) - addressable (2.3.5) - airbrake (3.1.2) - activesupport - builder - annotate (2.6.0) - activerecord (>= 2.3.0) - rake (>= 0.8.7) - arel (4.0.1) - atomic (1.1.14) - barber (0.4.2) - ember-source - execjs - handlebars-source - better_errors (1.0.1) - coderay (>= 1.0.0) - erubis (>= 2.6.6) - binding_of_caller (0.7.2) - debug_inspector (>= 0.0.1) - builder (3.1.4) - celluloid (0.15.2) - timers (~> 1.1.0) - certified (0.1.1) - coderay (1.1.0) - connection_pool (1.2.0) - daemons (1.1.9) - debug_inspector (0.0.2) - diff-lcs (1.2.4) - email_reply_parser-discourse (0.6) - ember-data-source (0.14) - ember-source - ember-rails (0.14.1) - active_model_serializers - barber (>= 0.4.1) - ember-data-source - ember-source - execjs (>= 1.2) - handlebars-source - jquery-rails (>= 1.0.17) - railties (>= 3.1) - ember-source (1.2.0.1) - handlebars-source (~> 1.1.2) - erubis (2.7.0) - eventmachine (1.0.3) - excon (0.28.0) - execjs (2.0.2) - exifr (1.1.3) - fabrication (2.8.1) - fakeweb (1.3.0) - faraday (0.8.8) - multipart-post (~> 1.2.0) - fast_blank (0.0.1) - rake - rake-compiler - fast_stack (0.1.0) - rake - rake-compiler - fast_xor (1.1.2) - rake - rake-compiler - fast_xs (0.8.0) - fastimage (1.5.2) - ffi (1.9.3) - flamegraph (0.0.5) - fast_stack - fog (1.18.0) - builder - excon (~> 0.28.0) - formatador (~> 0.2.0) - mime-types - multi_json (~> 1.0) - net-scp (~> 1.1) - net-ssh (>= 2.1.3) - nokogiri (~> 1.5) - ruby-hmac - formatador (0.2.4) - fspath (2.0.5) - given_core (3.1.1) - sorcerer (>= 0.3.7) - guess_html_encoding (0.0.9) - handlebars-source (1.1.2) - hashie (2.0.5) - hexpress (1.2.0) - highline (1.6.20) - hike (1.2.3) - hiredis (0.4.5) - httpauth (0.2.0) - i18n (0.6.9) - image_optim (0.9.1) - exifr (~> 1.1.3) - fspath (~> 2.0.5) - image_size (~> 1.1.2) - in_threads (~> 1.2.0) - progress (~> 3.0.0) - image_size (1.1.3) - image_sorcery (1.1.0) - in_threads (1.2.0) - jquery-rails (3.0.4) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - json (1.8.1) - jwt (0.1.8) - multi_json (>= 1.5) - kgio (2.8.1) - librarian (0.1.1) - highline - thor (~> 0.15) - libv8 (3.16.14.3) - listen (0.7.3) - lru_redux (0.8.1) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - message_bus (0.9.4) - eventmachine - rack (>= 1.1.3) - redis - metaclass (0.0.1) - method_source (0.8.2) - mime-types (1.25.1) - mini_portile (0.5.2) - minitest (4.7.5) - mocha (0.14.0) - metaclass (~> 0.0.1) - mock_redis (0.9.0) - moneta (0.7.20) - msgpack (0.5.7) - multi_json (1.8.2) - multipart-post (1.2.0) - mustache (0.99.4) - net-scp (1.1.2) - net-ssh (>= 2.6.5) - net-ssh (2.7.0) - nokogiri (1.6.1) - mini_portile (~> 0.5.0) - oauth (0.4.7) - oauth2 (0.8.1) - faraday (~> 0.8) - httpauth (~> 0.1) - jwt (~> 0.1.4) - multi_json (~> 1.0) - rack (~> 1.2) - oj (2.2.3) - omniauth (1.1.4) - hashie (>= 1.2, < 3) - rack - omniauth-facebook (1.4.1) - omniauth-oauth2 (~> 1.1.0) - omniauth-github (1.1.1) - omniauth (~> 1.0) - omniauth-oauth2 (~> 1.1) - omniauth-oauth (1.0.1) - oauth - omniauth (~> 1.0) - omniauth-oauth2 (1.1.1) - oauth2 (~> 0.8.0) - omniauth (~> 1.0) - omniauth-openid (1.0.1) - omniauth (~> 1.0) - rack-openid (~> 1.3.1) - omniauth-twitter (1.0.1) - multi_json (~> 1.3) - omniauth-oauth (~> 1.0) - onebox (1.2.0) - hexpress (~> 1.2) - moneta (~> 0.7) - multi_json (~> 1.7) - mustache (~> 0.99) - nokogiri (~> 1.6.1) - opengraph_parser (~> 0.2.3) - opengraph_parser (0.2.3) - addressable - nokogiri - openid-redis-store (0.0.2) - redis - ruby-openid - pg (0.15.1) - polyglot (0.3.3) - progress (3.0.0) - pry (0.9.12.4) - coderay (~> 1.0) - method_source (~> 0.8) - slop (~> 3.4) - pry-nav (0.2.3) - pry (~> 0.9.10) - pry-rails (0.3.2) - pry (>= 0.9.10) - puma (2.6.0) - rack (>= 1.1, < 2.0) - qunit-rails (0.0.4) - railties (>= 3.2.3) - rack (1.5.2) - rack-cors (0.2.8) - rack - rack-mini-profiler (0.9.0) - rack (>= 1.1.3) - rack-openid (1.3.1) - rack (>= 1.1.0) - ruby-openid (>= 2.1.8) - rack-protection (1.5.1) - rack - rack-test (0.6.2) - rack (>= 1.0) - rails (4.0.2) - actionmailer (= 4.0.2) - actionpack (= 4.0.2) - activerecord (= 4.0.2) - activesupport (= 4.0.2) - bundler (>= 1.3.0, < 2.0) - railties (= 4.0.2) - sprockets-rails (~> 2.0.0) - rails-observers (0.1.2) - activemodel (~> 4.0) - railties (4.0.2) - actionpack (= 4.0.2) - activesupport (= 4.0.2) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - raindrops (0.12.0) - rake (10.1.1) - rake-compiler (0.9.2) - rake - rb-fsevent (0.9.3) - rb-inotify (0.9.2) - ffi (>= 0.5.0) - rbtrace (0.4.1) - ffi (>= 1.0.6) - msgpack (>= 0.4.3) - trollop (>= 1.16.2) - redcarpet (3.0.0) - redis (3.0.6) - redis-namespace (1.3.2) - redis (~> 3.0.4) - ref (1.0.5) - rest-client (1.6.7) - mime-types (>= 1.16) - rinku (1.7.3) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.6) - rspec-expectations (2.14.3) - diff-lcs (>= 1.1.3, < 2.0) - rspec-given (3.1.1) - given_core (= 3.1.1) - rspec (>= 2.12) - rspec-mocks (2.14.4) - rspec-rails (2.14.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - ruby-hmac (0.4.0) - ruby-openid (2.3.0) - ruby-readability (0.5.7) - guess_html_encoding (>= 0.0.4) - nokogiri (>= 1.4.2) - sanitize (2.0.6) - nokogiri (>= 1.4.4) - sass (3.2.12) - sass-rails (4.0.1) - railties (>= 4.0.0, < 5.0) - sass (>= 3.1.10) - sprockets-rails (~> 2.0.0) - seed-fu-discourse (2.2.0) - activerecord (>= 3.1, < 4.1) - activesupport (>= 3.1, < 4.1) - shoulda (3.5.0) - shoulda-context (~> 1.0, >= 1.0.1) - shoulda-matchers (>= 1.4.1, < 3.0) - shoulda-context (1.1.5) - shoulda-matchers (2.4.0) - activesupport (>= 3.0.0) - sidekiq (2.15.1) - celluloid (>= 0.15.1) - connection_pool (>= 1.0.0) - json - redis (>= 3.0.4) - redis-namespace (>= 1.3.1) - sidekiq-failures (0.2.2) - sidekiq (>= 2.9.0) - simple-rss (1.3.1) - simplecov (0.7.1) - multi_json (~> 1.0) - simplecov-html (~> 0.7.1) - simplecov-html (0.7.1) - sinatra (1.4.4) - rack (~> 1.4) - rack-protection (~> 1.4) - tilt (~> 1.3, >= 1.3.4) - slim (2.0.1) - temple (~> 0.6.6) - tilt (>= 1.3.3, < 2.1) - slop (3.4.7) - sorcerer (1.0.2) - spork (1.0.0rc4) - spork-rails (4.0.0) - rails (>= 3.0.0, < 5) - spork (>= 1.0rc0) - sprockets (2.10.1) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.0.1) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (~> 2.8) - temple (0.6.7) - therubyracer (0.12.1) - libv8 (~> 3.16.14.0) - ref - thin (1.6.1) - daemons (>= 1.0.9) - eventmachine (>= 1.0.0) - rack (>= 1.0.0) - thor (0.18.1) - thread_safe (0.1.3) - atomic - tilt (1.4.1) - timecop (0.6.3) - timers (1.1.0) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - trollop (2.0) - tzinfo (0.3.38) - uglifier (2.3.3) - execjs (>= 0.3.0) - json (>= 1.8.0) - unf (0.1.3) - unf_ext - unf_ext (0.0.6) - unicorn (4.7.0) - kgio (~> 2.6) - rack - raindrops (~> 0.7) - -PLATFORMS - ruby - -DEPENDENCIES - actionpack-action_caching - active_model_serializers - airbrake (= 3.1.2) - annotate - barber - better_errors - binding_of_caller - certified - discourse_plugin! - email_reply_parser-discourse - ember-rails - ember-source (~> 1.2.0.1) - eventmachine - fabrication - fakeweb (~> 1.3.0) - fast_blank - fast_xor - fast_xs - fastimage - flamegraph - fog (= 1.18.0) - handlebars-source (~> 1.1.2) - highline - hiredis - image_optim - image_sorcery - librarian (>= 0.0.25) - listen (= 0.7.3) - lru_redux - message_bus - minitest - mocha - mock_redis - multi_json - mustache - nokogiri - oj - omniauth - omniauth-facebook - omniauth-github - omniauth-oauth2 - omniauth-openid - omniauth-twitter - onebox - openid-redis-store - pg (= 0.15.1) - pry-nav - pry-rails - puma - qunit-rails - rack-cors - rack-mini-profiler - rack-protection - rails - rails-observers - rails_multisite! - rake - rb-fsevent - rb-inotify (~> 0.9) - rbtrace - redcarpet - redis - rest-client - rinku - rspec-given - rspec-rails - ruby-readability - sanitize - sass - sass-rails - seed-fu-discourse - shoulda - sidekiq (= 2.15.1) - sidekiq-failures - simple-rss - simplecov - sinatra - slim - spork-rails - therubyracer - thin - timecop - uglifier - unf - unicorn diff --git a/Gemfile_rails_master.lock b/Gemfile_rails_master.lock deleted file mode 100644 index 0d07a16e8d6..00000000000 --- a/Gemfile_rails_master.lock +++ /dev/null @@ -1,490 +0,0 @@ -GIT - remote: https://github.com/dysania/onebox.git - revision: 6a2f6e6a08f183a4df52f9a51187f566b8ae3a00 - specs: - onebox (1.1.0) - hexpress (~> 1.2) - moneta (~> 0.7) - multi_json (~> 1.7) - mustache (~> 0.99) - nokogiri (~> 1.6.1) - opengraph_parser (~> 0.2.3) - -GIT - remote: https://github.com/rails/actionpack-action_caching.git - revision: a45e97298f6a77a4d74662521715d5656b821f24 - specs: - actionpack-action_caching (1.1.0) - actionpack (>= 4.0.0, < 5.0) - -GIT - remote: https://github.com/rails/rails.git - revision: 3a428f38b2f9a1e995070a4a049645b622c7094a - specs: - actionmailer (4.1.0.beta1) - actionpack (= 4.1.0.beta1) - actionview (= 4.1.0.beta1) - mail (~> 2.5.4) - actionpack (4.1.0.beta1) - actionview (= 4.1.0.beta1) - activesupport (= 4.1.0.beta1) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - actionview (4.1.0.beta1) - activesupport (= 4.1.0.beta1) - builder (~> 3.1) - erubis (~> 2.7.0) - activemodel (4.1.0.beta1) - activesupport (= 4.1.0.beta1) - builder (~> 3.1) - activerecord (4.1.0.beta1) - activemodel (= 4.1.0.beta1) - activesupport (= 4.1.0.beta1) - arel (~> 5.0.0) - activesupport (4.1.0.beta1) - i18n (~> 0.6, >= 0.6.9) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.1) - tzinfo (~> 1.1) - rails (4.1.0.beta1) - actionmailer (= 4.1.0.beta1) - actionpack (= 4.1.0.beta1) - actionview (= 4.1.0.beta1) - activemodel (= 4.1.0.beta1) - activerecord (= 4.1.0.beta1) - activesupport (= 4.1.0.beta1) - bundler (>= 1.3.0, < 2.0) - railties (= 4.1.0.beta1) - sprockets-rails (~> 2.0.0) - railties (4.1.0.beta1) - actionpack (= 4.1.0.beta1) - activesupport (= 4.1.0.beta1) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - -PATH - remote: vendor/gems/discourse_plugin - specs: - discourse_plugin (0.0.1) - -PATH - remote: vendor/gems/rails_multisite - specs: - rails_multisite (0.0.1) - -GEM - remote: https://rubygems.org/ - specs: - active_model_serializers (0.8.1) - activemodel (>= 3.0) - addressable (2.3.5) - airbrake (3.1.2) - activesupport - builder - annotate (2.6.0) - activerecord (>= 2.3.0) - rake (>= 0.8.7) - arel (5.0.0) - atomic (1.1.14) - barber (0.4.2) - ember-source - execjs - handlebars-source - better_errors (1.0.1) - coderay (>= 1.0.0) - erubis (>= 2.6.6) - binding_of_caller (0.7.2) - debug_inspector (>= 0.0.1) - builder (3.2.2) - celluloid (0.15.2) - timers (~> 1.1.0) - certified (0.1.1) - coderay (1.1.0) - connection_pool (1.2.0) - daemons (1.1.9) - debug_inspector (0.0.2) - diff-lcs (1.2.4) - email_reply_parser-discourse (0.6) - ember-data-source (0.14) - ember-source - ember-rails (0.14.1) - active_model_serializers - barber (>= 0.4.1) - ember-data-source - ember-source - execjs (>= 1.2) - handlebars-source - jquery-rails (>= 1.0.17) - railties (>= 3.1) - ember-source (1.2.0.1) - handlebars-source (~> 1.1.2) - erubis (2.7.0) - eventmachine (1.0.3) - excon (0.28.0) - execjs (2.0.2) - exifr (1.1.3) - fabrication (2.8.1) - fakeweb (1.3.0) - faraday (0.8.8) - multipart-post (~> 1.2.0) - fast_blank (0.0.1) - rake - rake-compiler - fast_stack (0.1.0) - rake - rake-compiler - fast_xor (1.1.2) - rake - rake-compiler - fast_xs (0.8.0) - fastimage (1.5.2) - ffi (1.9.3) - flamegraph (0.0.5) - fast_stack - fog (1.18.0) - builder - excon (~> 0.28.0) - formatador (~> 0.2.0) - mime-types - multi_json (~> 1.0) - net-scp (~> 1.1) - net-ssh (>= 2.1.3) - nokogiri (~> 1.5) - ruby-hmac - formatador (0.2.4) - fspath (2.0.5) - given_core (3.1.1) - sorcerer (>= 0.3.7) - guess_html_encoding (0.0.9) - handlebars-source (1.1.2) - hashie (2.0.5) - hexpress (1.2.0) - highline (1.6.20) - hike (1.2.3) - hiredis (0.4.5) - httpauth (0.2.0) - i18n (0.6.9) - image_optim (0.9.1) - exifr (~> 1.1.3) - fspath (~> 2.0.5) - image_size (~> 1.1.2) - in_threads (~> 1.2.0) - progress (~> 3.0.0) - image_size (1.1.3) - image_sorcery (1.1.0) - in_threads (1.2.0) - jquery-rails (3.0.4) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - json (1.8.1) - jwt (0.1.8) - multi_json (>= 1.5) - kgio (2.8.1) - librarian (0.1.1) - highline - thor (~> 0.15) - libv8 (3.16.14.3) - listen (0.7.3) - lru_redux (0.8.1) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - message_bus (0.9.3.2) - eventmachine - rack (>= 1.1.3) - redis - metaclass (0.0.1) - method_source (0.8.2) - mime-types (1.25.1) - mini_portile (0.5.2) - minitest (5.2.2) - mocha (0.14.0) - metaclass (~> 0.0.1) - mock_redis (0.9.0) - moneta (0.7.20) - msgpack (0.5.7) - multi_json (1.8.4) - multipart-post (1.2.0) - mustache (0.99.4) - net-scp (1.1.2) - net-ssh (>= 2.6.5) - net-ssh (2.7.0) - nokogiri (1.6.1) - mini_portile (~> 0.5.0) - oauth (0.4.7) - oauth2 (0.8.1) - faraday (~> 0.8) - httpauth (~> 0.1) - jwt (~> 0.1.4) - multi_json (~> 1.0) - rack (~> 1.2) - oj (2.2.3) - omniauth (1.1.4) - hashie (>= 1.2, < 3) - rack - omniauth-facebook (1.4.1) - omniauth-oauth2 (~> 1.1.0) - omniauth-github (1.1.1) - omniauth (~> 1.0) - omniauth-oauth2 (~> 1.1) - omniauth-oauth (1.0.1) - oauth - omniauth (~> 1.0) - omniauth-oauth2 (1.1.1) - oauth2 (~> 0.8.0) - omniauth (~> 1.0) - omniauth-openid (1.0.1) - omniauth (~> 1.0) - rack-openid (~> 1.3.1) - omniauth-twitter (1.0.1) - multi_json (~> 1.3) - omniauth-oauth (~> 1.0) - opengraph_parser (0.2.3) - addressable - nokogiri - openid-redis-store (0.0.2) - redis - ruby-openid - pg (0.15.1) - polyglot (0.3.3) - progress (3.0.0) - pry (0.9.12.4) - coderay (~> 1.0) - method_source (~> 0.8) - slop (~> 3.4) - pry-nav (0.2.3) - pry (~> 0.9.10) - pry-rails (0.3.2) - pry (>= 0.9.10) - puma (2.6.0) - rack (>= 1.1, < 2.0) - qunit-rails (0.0.4) - railties (>= 3.2.3) - rack (1.5.2) - rack-cors (0.2.8) - rack - rack-mini-profiler (0.9.0.pre) - rack (>= 1.1.3) - rack-openid (1.3.1) - rack (>= 1.1.0) - ruby-openid (>= 2.1.8) - rack-protection (1.5.1) - rack - rack-test (0.6.2) - rack (>= 1.0) - rails-observers (0.1.2) - activemodel (~> 4.0) - raindrops (0.12.0) - rake (10.1.1) - rake-compiler (0.9.2) - rake - rb-fsevent (0.9.3) - rb-inotify (0.9.2) - ffi (>= 0.5.0) - rbtrace (0.4.1) - ffi (>= 1.0.6) - msgpack (>= 0.4.3) - trollop (>= 1.16.2) - redcarpet (3.0.0) - redis (3.0.6) - redis-namespace (1.3.2) - redis (~> 3.0.4) - ref (1.0.5) - rest-client (1.6.7) - mime-types (>= 1.16) - rinku (1.7.3) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.6) - rspec-expectations (2.14.3) - diff-lcs (>= 1.1.3, < 2.0) - rspec-given (3.1.1) - given_core (= 3.1.1) - rspec (>= 2.12) - rspec-mocks (2.14.4) - rspec-rails (2.14.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - ruby-hmac (0.4.0) - ruby-openid (2.3.0) - ruby-readability (0.6.0) - guess_html_encoding (>= 0.0.4) - nokogiri (>= 1.4.2) - sanitize (2.0.6) - nokogiri (>= 1.4.4) - sass (3.2.12) - sass-rails (4.0.1) - railties (>= 4.0.0, < 5.0) - sass (>= 3.1.10) - sprockets-rails (~> 2.0.0) - seed-fu-discourse (2.2.0) - activerecord (>= 3.1, < 4.1) - activesupport (>= 3.1, < 4.1) - shoulda (3.5.0) - shoulda-context (~> 1.0, >= 1.0.1) - shoulda-matchers (>= 1.4.1, < 3.0) - shoulda-context (1.1.5) - shoulda-matchers (2.4.0) - activesupport (>= 3.0.0) - sidekiq (2.15.1) - celluloid (>= 0.15.1) - connection_pool (>= 1.0.0) - json - redis (>= 3.0.4) - redis-namespace (>= 1.3.1) - sidekiq-failures (0.2.2) - sidekiq (>= 2.9.0) - simple-rss (1.3.1) - simplecov (0.7.1) - multi_json (~> 1.0) - simplecov-html (~> 0.7.1) - simplecov-html (0.7.1) - sinatra (1.4.4) - rack (~> 1.4) - rack-protection (~> 1.4) - tilt (~> 1.3, >= 1.3.4) - slim (2.0.1) - temple (~> 0.6.6) - tilt (>= 1.3.3, < 2.1) - slop (3.4.7) - sorcerer (1.0.2) - spork (1.0.0rc4) - spork-rails (4.0.0) - rails (>= 3.0.0, < 5) - spork (>= 1.0rc0) - sprockets (2.10.1) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.0.1) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (~> 2.8) - temple (0.6.7) - therubyracer (0.12.1) - libv8 (~> 3.16.14.0) - ref - thin (1.6.1) - daemons (>= 1.0.9) - eventmachine (>= 1.0.0) - rack (>= 1.0.0) - thor (0.18.1) - thread_safe (0.1.3) - atomic - tilt (1.4.1) - timecop (0.6.3) - timers (1.1.0) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - trollop (2.0) - tzinfo (1.1.0) - thread_safe (~> 0.1) - uglifier (2.3.1) - execjs (>= 0.3.0) - json (>= 1.8.0) - unf (0.1.3) - unf_ext - unf_ext (0.0.6) - unicorn (4.7.0) - kgio (~> 2.6) - rack - raindrops (~> 0.7) - -PLATFORMS - ruby - -DEPENDENCIES - actionpack-action_caching! - active_model_serializers - airbrake (= 3.1.2) - annotate - barber - better_errors - binding_of_caller - certified - discourse_plugin! - email_reply_parser-discourse - ember-rails - ember-source (~> 1.2.0.1) - eventmachine - fabrication - fakeweb (~> 1.3.0) - fast_blank - fast_xor - fast_xs - fastimage - flamegraph - fog (= 1.18.0) - handlebars-source (~> 1.1.2) - highline - hiredis - image_optim - image_sorcery - librarian (>= 0.0.25) - listen (= 0.7.3) - lru_redux - message_bus - minitest - mocha - mock_redis - multi_json - mustache - nokogiri - oj - omniauth - omniauth-facebook - omniauth-github - omniauth-oauth2 - omniauth-openid - omniauth-twitter - onebox! - openid-redis-store - pg (= 0.15.1) - pry-nav - pry-rails - puma - qunit-rails - rack-cors - rack-mini-profiler - rack-protection - rails! - rails-observers - rails_multisite! - rake - rb-fsevent - rb-inotify (~> 0.9) - rbtrace - redcarpet - redis - rest-client - rinku - rspec-given - rspec-rails - ruby-readability - sanitize - sass - sass-rails - seed-fu-discourse - shoulda - sidekiq (= 2.15.1) - sidekiq-failures - simple-rss - simplecov - sinatra - slim - spork-rails - therubyracer - thin - timecop - uglifier - unf - unicorn diff --git a/app/models/category.rb b/app/models/category.rb index 6c7c2073922..ffc79b85a38 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -5,17 +5,10 @@ class Category < ActiveRecord::Base include Concern::Positionable belongs_to :topic, dependent: :destroy - if rails4? - belongs_to :topic_only_relative_url, - -> { select "id, title, slug" }, - class_name: "Topic", - foreign_key: "topic_id" - else - belongs_to :topic_only_relative_url, - select: "id, title, slug", - class_name: "Topic", - foreign_key: "topic_id" - end + belongs_to :topic_only_relative_url, + -> { select "id, title, slug" }, + class_name: "Topic", + foreign_key: "topic_id" belongs_to :user belongs_to :latest_post, class_name: "Post" @@ -81,7 +74,7 @@ class Category < ActiveRecord::Base def self.scoped_to_permissions(guardian, permission_types) if guardian && guardian.is_staff? - rails4? ? all : scoped + all else permission_types = permission_types.map{ |permission_type| CategoryGroup.permission_types[permission_type] diff --git a/app/models/discourse_version_check.rb b/app/models/discourse_version_check.rb index 01a1a9d0524..1ac0da47f06 100644 --- a/app/models/discourse_version_check.rb +++ b/app/models/discourse_version_check.rb @@ -1,17 +1,5 @@ class DiscourseVersionCheck - if rails4? - include ActiveModel::Model - else - include ActiveAttr::Attributes - include ActiveAttr::MassAssignment - include ActiveModel::Serialization - end + include ActiveModel::Model attr_accessor :latest_version, :critical_updates, :installed_version, :installed_sha, :missing_versions_count, :updated_at, :version_check_pending - - unless rails4? - def active_model_serializer - DiscourseVersionCheckSerializer - end - end end \ No newline at end of file diff --git a/app/models/incoming_links_report.rb b/app/models/incoming_links_report.rb index 4177576a595..5d49ea9f07b 100644 --- a/app/models/incoming_links_report.rb +++ b/app/models/incoming_links_report.rb @@ -90,7 +90,6 @@ class IncomingLinksReport num_clicks = num_clicks.to_a.sort_by {|x| x[1]}.last(10).reverse # take the top 10 report.data = [] topics = Topic.select('id, slug, title').where('id in (?)', num_clicks.map {|z| z[0]}) - topics = topics.all unless rails4? num_clicks.each do |topic_id, num_clicks_element| topic = topics.find {|t| t.id == topic_id} if topic diff --git a/app/models/invite.rb b/app/models/invite.rb index d2da1c383b8..11c07bd9ee7 100644 --- a/app/models/invite.rb +++ b/app/models/invite.rb @@ -103,7 +103,7 @@ class Invite < ActiveRecord::Base filter: "%#{email_or_username.downcase}%" ) else - rails4? ? all : scoped + all end end diff --git a/app/models/topic.rb b/app/models/topic.rb index f084897dd99..ead9617ee70 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -69,10 +69,6 @@ class Topic < ActiveRecord::Base self.title = TextCleaner.clean_title(TextSentinel.title_sentinel(title).text) if errors[:title].empty? end - unless rails4? - serialize :meta_data, ActiveRecord::Coders::Hstore - end - belongs_to :category has_many :posts has_many :topic_allowed_users diff --git a/app/models/topic_featured_users.rb b/app/models/topic_featured_users.rb index fe6533a5580..1efb4cd48ce 100644 --- a/app/models/topic_featured_users.rb +++ b/app/models/topic_featured_users.rb @@ -11,7 +11,6 @@ class TopicFeaturedUsers # Chooses which topic users to feature def choose(args={}) - topic.reload unless rails4? clear update keys(args) update_participant_count diff --git a/app/models/user_email_observer.rb b/app/models/user_email_observer.rb index f83c85226ed..034a2e6492a 100644 --- a/app/models/user_email_observer.rb +++ b/app/models/user_email_observer.rb @@ -60,11 +60,7 @@ class UserEmailObserver < ActiveRecord::Observer end def after_commit(notification) - transaction_includes_action = if rails4? - notification.send(:transaction_include_any_action?, [:create]) - else - notification.send(:transaction_include_action?, :create) - end + transaction_includes_action = notification.send(:transaction_include_any_action?, [:create]) delegate_to_email_user notification if transaction_includes_action end diff --git a/config/application.rb b/config/application.rb index 7338c428082..7e0fc6c7bdb 100644 --- a/config/application.rb +++ b/config/application.rb @@ -125,11 +125,6 @@ module Discourse config.pbkdf2_iterations = 64000 config.pbkdf2_algorithm = "sha256" - # dumping rack lock cause the message bus does not work with it (throw :async, it catches Exception) - # see: https://github.com/sporkrb/spork/issues/66 - # rake assets:precompile also fails - config.threadsafe! unless rails4? || $PROGRAM_NAME =~ /spork|rake/ - # rack lock is nothing but trouble, get rid of it # for some reason still seeing it in Rails 4 config.middleware.delete Rack::Lock @@ -153,9 +148,6 @@ module Discourse config.ember.ember_location = "#{Rails.root}/vendor/assets/javascripts/production/ember.js" config.ember.handlebars_location = "#{Rails.root}/vendor/assets/javascripts/handlebars.js" - # Since we are using strong_parameters, we can disable and remove attr_accessible. - config.active_record.whitelist_attributes = false unless rails4? - require 'auth' Discourse.activate_plugins! unless Rails.env.test? and ENV['LOAD_PLUGINS'] != "1" @@ -167,13 +159,6 @@ module Discourse end end - # This is not really required per-se, but we do not want to support - # XML params, we see errors in our logs about malformed XML and there - # absolutly no spot in our app were we use XML as opposed to JSON endpoints - # - # Rails 4 no longer includes this by default - ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML) unless rails4? - if ENV['RBTRACE'] == "1" require 'rbtrace' end diff --git a/config/environments/development.rb b/config/environments/development.rb index 62d44db4e35..252304ba4f5 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -7,8 +7,7 @@ Discourse::Application.configure do config.cache_classes = false # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true unless rails4? - config.eager_load = false if rails4? + config.eager_load = false # Show full error reports and disable caching config.consider_all_requests_local = true @@ -17,9 +16,6 @@ Discourse::Application.configure do # Print deprecation notices to the Rails logger config.active_support.deprecation = :log - # Only use best-standards-support built into browsers - config.action_dispatch.best_standards_support = :builtin unless rails4? - # Do not compress assets config.assets.compress = false diff --git a/config/environments/production.rb b/config/environments/production.rb index 4a0e2af5c64..c359f8d7b20 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -12,12 +12,8 @@ Discourse::Application.configure do # Disable Rails's static asset server (Apache or nginx will already do this) config.serve_static_assets = GlobalSetting.serve_static_assets - if rails4? - config.assets.js_compressor = :uglifier - config.assets.css_compressor = :sass - else - config.assets.compress = true - end + config.assets.js_compressor = :uglifier + config.assets.css_compressor = :sass # stuff should be pre-compiled config.assets.compile = false diff --git a/config/environments/profile.rb b/config/environments/profile.rb index 9f9454c9af1..a498bcb8a71 100644 --- a/config/environments/profile.rb +++ b/config/environments/profile.rb @@ -1,7 +1,7 @@ Discourse::Application.configure do # Settings specified here will take precedence over those in config/application.rb - config.eager_load = true if rails4? + config.eager_load = true # Code is not reloaded between requests config.cache_classes = true diff --git a/config/environments/test.rb b/config/environments/test.rb index f1db1fda9ea..e63401fc8d7 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -41,7 +41,6 @@ Discourse::Application.configure do config.assets.digest = false # silence deprecation warnings in test - config.whiny_nils = true unless rails4? - config.eager_load = false if rails4? + config.eager_load = false ActiveSupport::Deprecation.silenced = true end diff --git a/db/migrate/20121123054127_make_post_number_distinct.rb b/db/migrate/20121123054127_make_post_number_distinct.rb index f6b4805a77d..fc8959cc838 100644 --- a/db/migrate/20121123054127_make_post_number_distinct.rb +++ b/db/migrate/20121123054127_make_post_number_distinct.rb @@ -19,12 +19,6 @@ from ) as X where calc <> p.post_number and X.id = p.id') - - # automagically does this - unless rails4? - remove_index :posts, :forum_thread_id_and_post_number - add_index :posts, [:topic_id, :post_number], unique: true - end end def down diff --git a/lib/discourse_observer.rb b/lib/discourse_observer.rb index bd64cfa8fa4..51161bc7d6c 100644 --- a/lib/discourse_observer.rb +++ b/lib/discourse_observer.rb @@ -33,24 +33,13 @@ else # Outside of test mode, use after_commit class DiscourseObserver < ActiveRecord::Observer def after_commit(model) - if rails4? - if model.send(:transaction_include_any_action?, [:create]) - after_create_delegator(model) - end - - if model.send(:transaction_include_any_action?, [:destroy]) - after_destroy_delegator(model) - end - else - if model.send(:transaction_include_action?, :create) - after_create_delegator(model) - end - - if model.send(:transaction_include_action?, :destroy) - after_destroy_delegator(model) - end + if model.send(:transaction_include_any_action?, [:create]) + after_create_delegator(model) end + if model.send(:transaction_include_any_action?, [:destroy]) + after_destroy_delegator(model) + end end end diff --git a/lib/freedom_patches/active_record_base.rb b/lib/freedom_patches/active_record_base.rb index c1ccedec68f..eafb7f72193 100644 --- a/lib/freedom_patches/active_record_base.rb +++ b/lib/freedom_patches/active_record_base.rb @@ -15,20 +15,6 @@ class ActiveRecord::Base ActiveRecord::Base.send(:sanitize_sql_array, sql_array) end - # exists fine in rails4 - unless rails4? - # note: update_attributes still spins up a transaction this can cause contention - # this method performs the raw update sidestepping the locking - # exists in rails 4 - def update_columns(hash) - self.class.where(self.class.primary_key => self.id).update_all(hash) - - hash.each do |k,v| - raw_write_attribute k, v - end - end - end - def exec_sql(*args) ActiveRecord::Base.exec_sql(*args) end diff --git a/lib/freedom_patches/active_record_relation.rb b/lib/freedom_patches/active_record_relation.rb deleted file mode 100644 index be6ca5a53b8..00000000000 --- a/lib/freedom_patches/active_record_relation.rb +++ /dev/null @@ -1,14 +0,0 @@ -unless rails4? - module ActiveRecord - class Relation - # Patch Rails 3 ActiveRecord::Relation to noop on Rails 4 references - # thereby getting code that works for rails 3 and 4 without - # deprecation warnings - - def references(*args) - self - end - - end - end -end diff --git a/lib/freedom_patches/arel_patch.rb b/lib/freedom_patches/arel_patch.rb index 3d03f649410..b2f26ee4f95 100644 --- a/lib/freedom_patches/arel_patch.rb +++ b/lib/freedom_patches/arel_patch.rb @@ -1,8 +1,6 @@ -if rails4? - # https://github.com/rails/arel/pull/206 - class Arel::Table - def hash - @name.hash - end +# https://github.com/rails/arel/pull/206 +class Arel::Table + def hash + @name.hash end -end +end \ No newline at end of file diff --git a/lib/freedom_patches/performance_fixes.rb b/lib/freedom_patches/performance_fixes.rb index ee6b66d0814..4f2a7034a3c 100644 --- a/lib/freedom_patches/performance_fixes.rb +++ b/lib/freedom_patches/performance_fixes.rb @@ -8,30 +8,4 @@ class ActiveRecord::Base def blank? false end -end - -unless rails4? - class ActionView::Helpers::AssetTagHelper::AssetIncludeTag - private - - # pluralization is fairly expensive, and pluralizing the word javascript 400 times is pointless - # this is fixed in Rails 4 - - def path_to_asset(source, options = {}) - asset_paths.compute_public_path(source, pluralize_asset_name(asset_name), options.merge(:ext => extension)) - end - - - def path_to_asset_source(source) - asset_paths.compute_source_path(source, pluralize_asset_name(asset_name), extension) - end - - - def pluralize_asset_name(asset_name) - @@pluralization_cache ||= {} - plural = @@pluralization_cache[asset_name] ||= asset_name.to_s.pluralize - end - - end -end - +end \ No newline at end of file diff --git a/lib/freedom_patches/rails_security_fixes.rb b/lib/freedom_patches/rails_security_fixes.rb deleted file mode 100644 index a0ff8f6bc03..00000000000 --- a/lib/freedom_patches/rails_security_fixes.rb +++ /dev/null @@ -1,127 +0,0 @@ -unless rails4? - module HTML - class WhiteListSanitizer - # Sanitizes a block of css code. Used by #sanitize when it comes across a style attribute - def sanitize_css(style) - # disallow urls - style = style.to_s.gsub(/url\s*\(\s*[^\s)]+?\s*\)\s*/, ' ') - - # gauntlet - if style !~ /\A([:,;#%.\sa-zA-Z0-9!]|\w-\w|\'[\s\w]+\'|\"[\s\w]+\"|\([\d,\s]+\))*\z/ || - style !~ /\A(\s*[-\w]+\s*:\s*[^:;]*(;|$)\s*)*\z/ - return '' - end - - clean = [] - style.scan(/([-\w]+)\s*:\s*([^:;]*)/) do |prop,val| - if allowed_css_properties.include?(prop.downcase) - clean << prop + ': ' + val + ';' - elsif shorthand_css_properties.include?(prop.split('-')[0].downcase) - unless val.split().any? do |keyword| - !allowed_css_keywords.include?(keyword) && - keyword !~ /\A(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)\z/ - end - clean << prop + ': ' + val + ';' - end - end - end - clean.join(' ') - end - end - end - - module HTML - class WhiteListSanitizer - self.protocol_separator = /:|(�*58)|(p)|(�*3a)|(%|%)3A/i - - def contains_bad_protocols?(attr_name, value) - uri_attributes.include?(attr_name) && - (value =~ /(^[^\/:]*):|(�*58)|(p)|(�*3a)|(%|%)3A/i && !allowed_protocols.include?(value.split(protocol_separator).first.downcase.strip)) - end - end - end - - module ActiveRecord - class Relation - - def where_values_hash - values = rails_master? ? where_values : with_default_scope.where_values - - equalities = values.grep(Arel::Nodes::Equality).find_all { |node| - node.left.relation.name == table_name - } - - Hash[equalities.map { |where| [where.left.name, where.right] }].with_indifferent_access - end - - end - end - - module ActiveRecord - class PredicateBuilder # :nodoc: - def self.build_from_hash(engine, attributes, default_table, allow_table_name = true) - predicates = attributes.map do |column, value| - table = default_table - - if allow_table_name && value.is_a?(Hash) - table = Arel::Table.new(column, engine) - - if value.empty? - '1 = 2' - else - build_from_hash(engine, value, table, false) - end - else - column = column.to_s - - if allow_table_name && column.include?('.') - table_name, column = column.split('.', 2) - table = Arel::Table.new(table_name, engine) - end - - attribute = table[column] - - case value - when ActiveRecord::Relation - value = value.select(value.klass.arel_table[value.klass.primary_key]) if value.select_values.empty? - attribute.in(value.arel.ast) - when Array, ActiveRecord::Associations::CollectionProxy - values = value.to_a.map {|x| x.is_a?(ActiveRecord::Base) ? x.id : x} - ranges, values = values.partition {|v| v.is_a?(Range) || v.is_a?(Arel::Relation)} - - array_predicates = ranges.map {|range| attribute.in(range)} - - if values.include?(nil) - values = values.compact - if values.empty? - array_predicates << attribute.eq(nil) - else - array_predicates << attribute.in(values.compact).or(attribute.eq(nil)) - end - else - array_predicates << attribute.in(values) - end - - array_predicates.inject {|composite, predicate| composite.or(predicate)} - when Range, Arel::Relation - attribute.in(value) - when ActiveRecord::Base - attribute.eq(value.id) - when Class - # FIXME: I think we need to deprecate this behavior - attribute.eq(value.name) - when Integer, ActiveSupport::Duration - # Arel treats integers as literals, but they should be quoted when compared with strings - column = engine.connection.schema_cache.columns_hash[table.name][attribute.name.to_s] - attribute.eq(Arel::Nodes::SqlLiteral.new(engine.connection.quote(value, column))) - else - attribute.eq(value) - end - end - end - - predicates.flatten - end - end - end -end diff --git a/lib/trashable.rb b/lib/trashable.rb index d69f3ff215f..8bf8c86666f 100644 --- a/lib/trashable.rb +++ b/lib/trashable.rb @@ -17,10 +17,8 @@ module Trashable # scope = if rails_master? self.all - elsif rails4? - self.all.with_default_scope else - self.scoped.with_default_scope + self.all.with_default_scope end scope.where_values.delete(with_deleted_scope_sql) @@ -28,11 +26,7 @@ module Trashable end def with_deleted_scope_sql - if rails4? - all.table[:deleted_at].eq(nil).to_sql - else - scoped.table[:deleted_at].eq(nil).to_sql - end + all.table[:deleted_at].eq(nil).to_sql end end diff --git a/lib/validators/ip_address_format_validator.rb b/lib/validators/ip_address_format_validator.rb index ab79177593f..89b231c268d 100644 --- a/lib/validators/ip_address_format_validator.rb +++ b/lib/validators/ip_address_format_validator.rb @@ -3,23 +3,17 @@ class IpAddressFormatValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) - if rails4? - # In Rails 4.0.0, ip_address will be nil if an invalid IP address was assigned. - # https://github.com/jetthoughts/rails/commit/0aa95a71b04f2893921c58a7c1d9fca60dbdcbc2 + # In Rails 4.0.0, ip_address will be nil if an invalid IP address was assigned. + # https://github.com/jetthoughts/rails/commit/0aa95a71b04f2893921c58a7c1d9fca60dbdcbc2 - # BUT: in Rails 4.0.1, validators don't get a chance to - # run before IPAddr::InvalidAddressError is raised. - # I don't see what broke it in rails 4.0.1... - # So this validator doesn't actually do anything anymore. - # But let's keep it in case a future version of rails fixes the problem and allows - # validators to work on inet and cidr columns. - if record.ip_address.nil? - record.errors.add(attribute, :invalid) - end - else - unless !record.ip_address.nil? and record.ip_address.to_s.split('/').first =~ Resolv::AddressRegex - record.errors.add(attribute, :invalid) - end + # BUT: in Rails 4.0.1, validators don't get a chance to + # run before IPAddr::InvalidAddressError is raised. + # I don't see what broke it in rails 4.0.1... + # So this validator doesn't actually do anything anymore. + # But let's keep it in case a future version of rails fixes the problem and allows + # validators to work on inet and cidr columns. + if record.ip_address.nil? + record.errors.add(attribute, :invalid) end end diff --git a/spec/controllers/static_controller_spec.rb b/spec/controllers/static_controller_spec.rb index 79c1e751273..e77e4467d1d 100644 --- a/spec/controllers/static_controller_spec.rb +++ b/spec/controllers/static_controller_spec.rb @@ -14,11 +14,7 @@ describe StaticController do end it "renders the file" do - if rails4? - response.should render_template('static/faq.en') - else - response.should render_template('faq') - end + response.should render_template('static/faq.en') end end @@ -28,11 +24,7 @@ describe StaticController do context "when #{setting_name} site setting is NOT set" do it "renders the #{id} page" do - if rails4? - expect(subject).to render_template("static/#{id}.en") - else - expect(subject).to render_template(id) - end + expect(subject).to render_template("static/#{id}.en") end end diff --git a/vendor/gems/rails_multisite/lib/rails_multisite/connection_management.rb b/vendor/gems/rails_multisite/lib/rails_multisite/connection_management.rb index b7778d8b1b0..aeeb30359f1 100644 --- a/vendor/gems/rails_multisite/lib/rails_multisite/connection_management.rb +++ b/vendor/gems/rails_multisite/lib/rails_multisite/connection_management.rb @@ -16,24 +16,18 @@ module RailsMultisite handler = @@connection_handlers[spec] unless handler handler = ActiveRecord::ConnectionAdapters::ConnectionHandler.new - if rails4? - handler.establish_connection(ActiveRecord::Base, spec) - end + handler.establish_connection(ActiveRecord::Base, spec) @@connection_handlers[spec] = handler end else handler = @@default_connection_handler - if rails4? && !@@established_default + if !@@established_default handler.establish_connection(ActiveRecord::Base, spec) @@established_default = true end end ActiveRecord::Base.connection_handler = handler - - unless rails4? - handler.establish_connection("ActiveRecord::Base", spec) - end end end @@ -97,7 +91,7 @@ module RailsMultisite end def self.load_settings! - spec_klass = rails4? ? ActiveRecord::ConnectionAdapters::ConnectionSpecification : ActiveRecord::Base::ConnectionSpecification + spec_klass = ActiveRecord::ConnectionAdapters::ConnectionSpecification configs = YAML::load(File.open(self.config_filename)) configs.each do |k,v| raise ArgumentError.new("Please do not name any db default!") if k == "default"