Skip to content

Commit

Permalink
Rails 5.2 upgrade (publiclab#2927)
Browse files Browse the repository at this point in the history
* Changed the rails version in Gemfile

* Modified the mysql version in Gemfile

* Added the modified version of Gemfile.lock

* Removed some deprecation warnings

* Added comment about the usage of Arel.sql

* Removed few code climate issues
  • Loading branch information
Souravirus authored and jywarren committed Jul 2, 2018
1 parent a8d79ee commit de4834f
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 48 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ git_source(:github) do |repo_name|
"https://github.com/#{repo_name}.git"
end

gem 'rails', '5.1.5'
gem 'rails', '5.2.0'
gem 'activerecord-session_store'
gem 'passenger'
gem 'sidekiq'
Expand Down Expand Up @@ -69,7 +69,7 @@ gem 'reverse_markdown'

# run with `bundle install --without production` or `bundle install --without mysql` to exclude this
group :mysql, :production do
gem 'mysql2', '~> 0.3.20'
gem 'mysql2', '>= 0.4.4'
# mysql 0.4.3+ causes a version mismatch, apparently, and demands 'activerecord-mysql2-adapter'
end

Expand Down
95 changes: 51 additions & 44 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,53 +1,57 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.1.5)
actionpack (= 5.1.5)
actioncable (5.2.0)
actionpack (= 5.2.0)
nio4r (~> 2.0)
websocket-driver (~> 0.6.1)
actionmailer (5.1.5)
actionpack (= 5.1.5)
actionview (= 5.1.5)
activejob (= 5.1.5)
websocket-driver (>= 0.6.1)
actionmailer (5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.1.5)
actionview (= 5.1.5)
activesupport (= 5.1.5)
actionpack (5.2.0)
actionview (= 5.2.0)
activesupport (= 5.2.0)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.1.5)
activesupport (= 5.1.5)
actionview (5.2.0)
activesupport (= 5.2.0)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.1.5)
activesupport (= 5.1.5)
activejob (5.2.0)
activesupport (= 5.2.0)
globalid (>= 0.3.6)
activemodel (5.1.5)
activesupport (= 5.1.5)
activerecord (5.1.5)
activemodel (= 5.1.5)
activesupport (= 5.1.5)
arel (~> 8.0)
activemodel (5.2.0)
activesupport (= 5.2.0)
activerecord (5.2.0)
activemodel (= 5.2.0)
activesupport (= 5.2.0)
arel (>= 9.0)
activerecord-session_store (1.1.1)
actionpack (>= 4.0)
activerecord (>= 4.0)
multi_json (~> 1.11, >= 1.11.2)
rack (>= 1.5.2, < 3)
railties (>= 4.0)
activesupport (5.1.5)
activestorage (5.2.0)
actionpack (= 5.2.0)
activerecord (= 5.2.0)
marcel (~> 0.3.1)
activesupport (5.2.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
ansi (1.5.0)
arel (8.0.0)
arel (9.0.0)
ast (2.4.0)
authlogic (4.1.0)
activerecord (>= 4.2, < 5.3)
Expand Down Expand Up @@ -82,8 +86,8 @@ GEM
execjs
coffee-script-source (1.12.2)
commonjs (0.2.7)
composite_primary_keys (10.0.3)
activerecord (~> 5.1.0, >= 5.1.5)
composite_primary_keys (11.0.3)
activerecord (~> 5.2.0)
concurrent-ruby (1.0.5)
connection_pool (2.2.2)
coveralls (0.8.21)
Expand Down Expand Up @@ -146,7 +150,7 @@ GEM
http-cookie (1.0.3)
domain_name (~> 0.5)
http_accept_language (2.1.1)
i18n (0.9.5)
i18n (1.0.1)
concurrent-ruby (~> 1.0)
i18n-js (3.0.9)
i18n (>= 0.6.6, < 2)
Expand Down Expand Up @@ -198,6 +202,8 @@ GEM
listen (>= 0.4.1)
mail (>= 2.0.3)
maildir (>= 0.5.0)
marcel (0.3.2)
mimemagic (~> 0.3.2)
metaclass (0.0.4)
method_source (0.9.0)
mime-types (3.1)
Expand All @@ -220,7 +226,7 @@ GEM
mustermann (1.0.2)
mustermann-grape (1.0.0)
mustermann (~> 1.0.0)
mysql2 (0.3.21)
mysql2 (0.5.1)
netrc (0.11.0)
nifty-generators (0.4.6)
nio4r (2.3.1)
Expand Down Expand Up @@ -267,7 +273,7 @@ GEM
parallel (1.12.1)
parser (2.5.1.0)
ast (~> 2.4.0)
passenger (5.3.2)
passenger (5.3.3)
rack
rake (>= 0.8.1)
phantomjs (2.1.1.0)
Expand All @@ -289,17 +295,18 @@ GEM
rack
rack-test (1.0.0)
rack (>= 1.0, < 3)
rails (5.1.5)
actioncable (= 5.1.5)
actionmailer (= 5.1.5)
actionpack (= 5.1.5)
actionview (= 5.1.5)
activejob (= 5.1.5)
activemodel (= 5.1.5)
activerecord (= 5.1.5)
activesupport (= 5.1.5)
rails (5.2.0)
actioncable (= 5.2.0)
actionmailer (= 5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
activemodel (= 5.2.0)
activerecord (= 5.2.0)
activestorage (= 5.2.0)
activesupport (= 5.2.0)
bundler (>= 1.3.0)
railties (= 5.1.5)
railties (= 5.2.0)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.2)
actionpack (~> 5.x, >= 5.0.1)
Expand All @@ -316,9 +323,9 @@ GEM
rails-perftest (0.0.7)
rails_autolink (1.1.6)
rails (> 3.1)
railties (5.1.5)
actionpack (= 5.1.5)
activesupport (= 5.1.5)
railties (5.2.0)
actionpack (= 5.2.0)
activesupport (= 5.2.0)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
Expand Down Expand Up @@ -435,7 +442,7 @@ GEM
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
websocket-driver (0.6.5)
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
whenever (0.10.0)
Expand Down Expand Up @@ -484,7 +491,7 @@ DEPENDENCIES
minitest-reporters (~> 1.1.19)
mocha (~> 1.1)
mustermann (= 1.0.2)
mysql2 (~> 0.3.20)
mysql2 (>= 0.4.4)
nifty-generators
omniauth (~> 1.3, >= 1.3.1)
omniauth-facebook (~> 4.0)
Expand All @@ -498,7 +505,7 @@ DEPENDENCIES
progress_bar
rack-cors
rack-openid
rails (= 5.1.5)
rails (= 5.2.0)
rails-controller-testing
rails-dom-testing
rails-i18n (~> 5.1.1)
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/notes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ def places
.references(:term_data)
.where('term_data.name = ?', 'chapter')
.group('node.nid')
.order('max(node_revisions.timestamp) DESC, node.nid')
.order(Arel.sql('max(node_revisions.timestamp) DESC, node.nid'))
.paginate(page: params[:page], per_page: 24)

#Arel.sql is used to remove a Deprecation warning while updating to rails 5.2.

render template: 'notes/tools_places'
end

Expand Down
4 changes: 3 additions & 1 deletion app/controllers/questions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ def show
@tags = @node.power_tag_objects('question')
@tagnames = @tags.collect(&:name)
@users = @node.answers.group(:uid)
.order('count(*) DESC')
.order(Arel.sql('count(*) DESC'))
.collect(&:author)

#Arel.sql is used to remove a Deprecation warning while updating to rails 5.2

set_sidebar :tags, @tagnames
end

Expand Down

0 comments on commit de4834f

Please sign in to comment.